Solved

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

Posted on 2010-11-29
11
376 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to count in a table in php 22 34
Presenting past 6 months bug 7 25
send post values 7 26
How would I do this...? 2 27
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

785 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