PDA

View Full Version : Echoing html + php function


trancedm
03-16-2005, 10:46 PM
hey guys im having trouble with echoing chunk of html codes and php function

i have this code so far:


elseif ($r['type'] == php_snippets) {
$script = $r['script'];
echo "
<div class=\"title\">PHP Snippets</div>
<div class=\"splitborder\">&nbsp;</div>
<p class=\"no-margin\"><strong>Name<span style=\"color: #ff9933;\">:</span></strong> ".$r['name']."<br/>
<strong>Date Added<span style=\"color: #ff9933;\">:</span></strong> ".$r['date']." <br/>
<strong>Description<span style=\"color: #ff9933;\">:</span></strong> <br/>
".$r['description']."</p>
<div class=\"show-code\">Code below...</div>
highlight_string($script)
<div class=\"splitborder\">&nbsp;</div>";
}


basically i have the function highlight_string($script) where "$script" is a php code, i want to highlight that code ($script) but for some reason its not evaluating it...

here's an example:
http://www.r2xdesign.net/index2.php?page=viewcontent&id=12

i think it has something to do with the way i have html and php function at the same "code"

i hope i make any sense and thanx in advance!

firepages
03-17-2005, 12:24 AM
highlight_string is a function and you cant use it within an echo statement in the way you are attempting , so try seperating them...


<?
echo 'blah blah' ;
highlight_string( $string ) ;
echo 'more blah' ;
?>

trancedm
03-17-2005, 12:45 AM
lol thanx :) i thought for sure that function can be echo

oh well, learn something new everyday