ok so i got this far:
PHP Code:
<?
$protein = "yummy protein bars <br /><br />";
echo str_replace_once("protein", array("<a href='http://www.google.com'>protein</a>"), $protein);
$creatine = "creatine is the blah blah blah blah blah";
echo str_replace_once("creatine", array("<a href='http://www.google.com'>creatine</a>"), $creatine);
function str_replace_once($search, $replace, $subject, &$offset = 0) {
if (is_array($replace)) {
foreach ($replace as $value) $subject = str_replace_once($search, $value, $subject, $offset);
} else {
$pos = strpos($subject, $search, $offset);
if ($pos !== false) {
$offset = $pos+strlen($search);
$subject = substr($subject, 0, $pos) . $replace . substr($subject, $offset);
}
}
return $subject;
}
?>
Any ideas how I should put it in Zen?
Bookmarks