Solved

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

Posted on 2010-11-29
11
367 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
  • 5
  • 5
11 Comments
 
LVL 17

Expert Comment

by:sweetfa2
Comment Utility
<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
Comment Utility
sorry - had no effect
0
 
LVL 82

Expert Comment

by:hielo
Comment Utility
<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
 

Author Comment

by:tramworksnick
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:tramworksnick
Comment Utility
just added !important to white text - sorry
0
 
LVL 82

Expert Comment

by:hielo
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks for persevering - a big help
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now