Link to home
Start Free TrialLog in
Avatar of tramworksnick
tramworksnick

asked on

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

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
Avatar of sweetfa2
sweetfa2
Flag of Australia image

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

Open in new window

Avatar of tramworksnick
tramworksnick

ASKER

sorry - had no effect
Avatar of hielo
<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.
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;"
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>
just added !important to white text - sorry
>>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;
If the problem persists, look at your browser's source code. What is the markup that your page is producing?
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

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for persevering - a big help