Hi, > > I have a string: ##CODE## and I want to replace that with <a > > href="somewhere.php?id=CODE">CODE</a>
I handle %code% tags in some templates I use... here's the code I have.. function show ($template, $tag) { $file = fopen ($template, "r") or die($error_string()); while (!feof($file)) { $line_in = fgets($file, 1024); $line_out .= $line_in; } if ($tag != 0) { foreach ($tag as $name => $value) { $line_out = str_replace ("%$name%", $value, $line_out); } } return $line_out; fclose ($file); } Hope that helps.. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php