View Full Version : Applying HTML tags to parts of PHP file
sparklywater
07-31-2008, 03:33 AM
I am trying to change the font-colour of part of a query in php, by using a CSS class in html.
I want the following code to have the css class 'time' applied to it.
'.vbdate($vbulletin->options['timeformat'], $dateline);
I have edited the above php code in this way:
echo '<span class=\"time\">' '.vbdate($vbulletin->options['timeformat'], $dateline) '</span>' ;
This code however does not work. Does anyone here know how I can correctly apply the 'time' class to a piece of code in php?
Lynne
07-31-2008, 02:16 PM
What is the full line of code? (Perhaps a few lines above and below.)
sparklywater
07-31-2008, 04:46 PM
Here is the full query from that section:
// ################################################## ############
// ###################### Start WTdatelineTOusertime ############
// gets dateline in unix format and converts it to visitor's time.
function WTdatelineTOusertime($dateline)
{
global $vbulletin, $vbphrase;
if ($dateline == 'Never' OR $dateline == '0')
{
return $vbphrase[never];
}
$readbable = vbdate($vbulletin->options['dateformat'], $dateline, true).' - '.vbdate($vbulletin->options['timeformat'], $dateline);
return $readbable;
}
The part in red is the part I want to apply the css class to.
Opserty
07-31-2008, 05:28 PM
Use tags when posting PHP. The syntax highlighting would probably have told you where you were going wrong...
Try something like:
[php] $readbable = vbdate($vbulletin->options['dateformat'], $dateline, true).' - <span class="time">'.vbdate($vbulletin->options['timeformat'], $dateline) .'</span>';
Else contact the author for further assistance.
RLShare
07-31-2008, 05:30 PM
Then you just add it to the string your storing in that variable. You echoing it is trying to send it to the browser.
$readbable = vbdate($vbulletin->options['dateformat'], $dateline, true).' -<span class=\"time\">' .vbdate($vbulletin->options['timeformat'], $dateline).'</span>';
return $readbable;
}
edit: There you go again OP...lol
sparklywater
07-31-2008, 09:11 PM
Thanks guys, much appreciated :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.