Solved

can I set color of text within the line of attached php?

Posted on 2010-11-29
11
387 Views
Last Modified: 2013-11-05
Hi

I've a line of text I want to change color on within php - the color of the line is set by CSS for all instances of textarea so I can't change via CSS without affecting the rest of the site - I'd like to specify within this code the color I want the text to appear here

 
<td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8); ?></td>

Open in new window


the code that sets html output is where I'm hoping alternatively it may be possible to add another parameter to set a color -

////
// Output a form textarea field
  function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
    global $HTTP_GET_VARS, $HTTP_POST_VARS;

    $field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

    if (tep_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= '>';

    if ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {
      if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
        $field .= tep_output_string_protected(stripslashes($HTTP_GET_VARS[$name]));
      } elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
        $field .= tep_output_string_protected(stripslashes($HTTP_POST_VARS[$name]));
      }
    } elseif (tep_not_null($text)) {
      $field .= tep_output_string_protected($text);
    }

    $field .= '</textarea>';

    return $field;
  }

Open in new window


thanks
0
Comment
Question by:tramworksnick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 17

Expert Comment

by:sweetfa2
ID: 34232051
<td><?php echo tep_draw_textarea_field('<font color=somecolor>' . 'message' . '</font>', 'soft', 40, 8); ?></td>

Open in new window

0
 

Author Comment

by:tramworksnick
ID: 34232127
sorry - had no effect
0
 
LVL 82

Expert Comment

by:hielo
ID: 34232210
<td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8,'style="color:blue;background-color:white;" '); ?></td>

should affect only that specific textarea (but as a whole). What you cannot do is change the color for a specific line of text within the textarea.
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:tramworksnick
ID: 34232271
Hi

I want to change all the text but still no joy but this time its displayed white text as before but added as text - style="color:black;background-color:white;"
0
 
LVL 82

Expert Comment

by:hielo
ID: 34232359
try adding important! at the end of each rule:
<td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8,'style="color:black !important;background-color:white !important;" '); ?></td>
0
 

Author Comment

by:tramworksnick
ID: 34232386
just added !important to white text - sorry
0
 
LVL 82

Expert Comment

by:hielo
ID: 34232407
>>I want to change all the text but still no joy but this time its displayed white text as before but added as text - style="color:black;background-color:white;"
background-color:white is the default (unless you are explicitly overriding them via css). Are you sure you don't want:
background-color:black; color:white;
0
 
LVL 82

Expert Comment

by:hielo
ID: 34232413
If the problem persists, look at your browser's source code. What is the markup that your page is producing?
0
 

Author Comment

by:tramworksnick
ID: 34232474
Hi

Definitely want black on white background - I've got the white background no problem just want to set the text to black

 Output below -
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
					  <tr>
						<td><table cellpadding="0" cellspacing="5" border="0" width="100%">
							<tr><td><textarea name="message" wrap="soft" cols="40" rows="8">style=&quot;color:black !important;background-color:white !important;&quot; </textarea></td></tr>
						</table></td>
					  </tr>

					</table></td>

Open in new window

0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 34232538
my apologies. That should be the SIXTH parameter, not the FIFTH. The FIFTH parameter needs to be an empty string:

<td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8,'', 'style="color:black !important;background-color:white !important;" '); ?></td>
0
 

Author Closing Comment

by:tramworksnick
ID: 34232597
thanks for persevering - a big help
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question