Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-11-29
11
Medium Priority
?
394 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

721 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