View Single Post
Old 07-09-2002, 04:39 AM   PM User | #4
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,904
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
lol - I still have not a clue whats going on here...

PHP Code:
<?
$col
=array(x=>"<font color=\"#006400\">",b=>"<font color=\"#00008B\">",c=>"<font color=\"#008B8B\">",
g=>"<font color=\"#006400\">",m=>"<font color=\"#8B008B\">",r=>"<font color=\"#8B0000\">",w=>"<font color=\"#808080\">",
y=>"<font color=\"#808000\">",B=>"<font color=\"#0000FF\">",C=>"<font color=\"#OOFFFF\">",G=>"<font color=\"#00FF00\">",
M=>"<font color=\"#FF00FF\">",R=>"<font color=\"#FF0000\">",W=>"<font color=\"#FFFFFF\">",Y=>"<font color=\"#FFFF00\">",
D=>"<font color=\"#636363\">");


$str="NSTR Siara: (long) {xA {Ws{wi{Dlve{wr{Wy {xbladed shortsword with a {Cc{cr{wy{Cs{wt{ca{Cl {xhilt{x belongs to Siara.";
$str=eregi_replace("\{([a-z]{1})","</font>{\".\$col[\\1].\"",$str);
echo 
htmlspecialchars($str);
echo 
"<br /><br />";
eval(
"echo \"$str\";");
?>
does some interesting stuff, but I am unsure where and when you want the font colours to appear and around what??
i.e.
is '{Ws'
supposed to translate to
{<font colour='#whatever'>s</font> ??

anyway the above may help?

it actually begs another question,

I a unsure how to achieve this within the ereg statement (which is why I eval'led)

$str=eregi_replace("\{([a-z]{1})","{$col[\\1]",$str);

'$col[\\1]' throws an error but there must be a way of achieving this??
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote