Optional FAQ number inclusion in search results

You have a suggestion for a future version of phpMyFAQ? Then post it here!

Moderator: Thorsten

Post Reply
Posts: 59
Joined: Sat Jan 30, 2010 1:01 am

Optional FAQ number inclusion in search results

Post by dajoker » Wed Jun 09, 2010 1:33 am

A customer likes having the FAQ number included with the search results. Including this is fairly trivial and the following adds it only to the text on the screen (not the element's title or the tooltip of the same). The number is also only added if it is not already in the title of the document being returned.

Return FAQ Number with results. example: '12345678: How to change from good to bad to ugly'
New database option created as follows: INSERT INTO faqconfig (config_name, config_value) VALUES ('main.showfaqnuminsearchresults', 'true');
Modified ./phpmyfaq/inc/function.php slightly as well on just one line to reference that setting and act accordingly; it also prevents duplicates in case the title container the FAQ number for some reason:
<quote file='./phpmyfaq/inc/function.php' version='2.6.5'>
< $oLink->text = $thema;
> $oLink->text = (($faqconfig->get('main.showfaqnuminsearchresults') && (!(preg_match('/' . $row->id . '/', $thema)))) ? ($row->id . ': ' . $thema) : ($thema));

I do not expect this will generate insane amounts of overhead considering that this line only runs once per TID printed to the screen, so ten times per call by default.


Post Reply