PDA

View Full Version : Glossary terms in posts


hate
03-09-2005, 10:49 AM
I found this hack very useful.

I am sure most like myself have their articles area with the same theam as their site.

So I wanted to use glossary codes thru out all posts on my forum as well.

In functions_showthread.php find
eval('$retval = "' . fetch_template($maintemplatename) . '";');

Above that add
# Glossary terms highlight
$glossarytermquery = $DB_site->query("SELECT term, tooltip FROM " . TABLE_PREFIX . "articles_glossary");
while($glossaryrow = $DB_site->fetch_array($glossarytermquery))
{
$term = preg_quote($glossaryrow['term'], "/");
$tooltip = $glossaryrow['tooltip'];
$term_match = "/\b($glossaryrow[term])\b/i";
$replace = "<acronym STYLE=\"cursor: help;\" title=\"$tooltip\"><u>$term</u></acronym>";
$post['message'] = preg_replace($term_match, $replace, $post['message'] );
}

All I did with the code is change the var name.

Now the glossary will show thru out your entire forum. I hope others find this usefull, just shows how cool this articles hack is.

greenhybrid
03-14-2005, 12:22 AM
Thanks :D

I'll have to go in later and edit the code. It's messing up links.