Hi,
Im doing a site where i have a db of terms and definitions and on the site i want to replace those terms with s popup with the definition.
This works fine - here is the code :
$query = "SELECT term, definition FROM #__glossary";
$database->setQuery($query);
$results = $database->loadObjectList();
foreach($results as $result){
$link=' <a class="mosinfopop" href="javascript:void(0)" onmouseover="return overlib(\'' .$result->definition. '\', CAPTION, \'' . $result->term . '\');" onmouseout="return nd();" style=\"$css\">'.$result->term.'</a> ';
$text=preg_replace('/\s+'.$result->term.'\s+/',$link,$text);
// $text = str_replace(strtolower($result->term),$link,$text);
}
HOWEVER problems arise when a term is found within one of the already inserted popup (from a previous loop!)
Anyone know how i would tackle this please ?