You are here:  » Code for pulling the Search Term and displaying

Support Forum



Code for pulling the Search Term and displaying

Submitted by TWDesigns on Sat, 2013-01-05 16:21 in

Hey David,

I am looking on how to pull what someone is currently searching for and display at the top of the page. For example if someone is searching for "Rabbits" then I would like for my heading that currently states "Product Search" to say "Product Search - You Are Currently Searching for Rabbits".

Is there a way to pull this without the term having to have been logged in the DB?

Thanks,
Tommy

Submitted by support on Mon, 2013-01-07 09:43

Hi Tommy,

Sure - in fact the distribution search.php already includes the query in the page title by way of this code at line 277:

 $banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong>&nbsp;";

$q can be used anywhere, so in your modified files, locate where "Product Search" is displayed as a string, e.g.

"Product Search"

...and REPLACE with:

"Product Search - You Are Currently Searching for ".htmlentities($q,ENT_QUOTES,$config_charset);

Cheers,
David.
--
PriceTapestry.com

Submitted by TWDesigns on Wed, 2013-01-09 21:16

Thank you David!