Page 1 of 1

Creating a link to search for a keyword - is it possible?

Posted: Fri Aug 13, 2010 1:54 am
by heffegg
Hi.
My client wants to have a list of keywords - for example "apple", "orange", "pear"
They want these words to be links that when clicked will search for matching results.
For example click on 'apple' will return a list of recipes that contain "apple"

Is this possible?
If so, can someone give me an example of the script/code required to implement this.

If not...  any ideas short of writing my own cms would be appreciated.

TIA
Heff.

Re: Creating a link to search for a keyword - is it possible?

Posted: Fri Aug 13, 2010 2:16 am
by jmcgin51
will this (the list of word-links) be a hard-coded list, or a dynamic list?

Re: Creating a link to search for a keyword - is it possible?

Posted: Fri Aug 13, 2010 2:48 am
by heffegg
hard-coded links from a chart.
I have implemented a fix using copy/paste from a search, but I am sure there must be a better way.

Re: Creating a link to search for a keyword - is it possible?

Posted: Fri Aug 13, 2010 5:30 am
by Peciura
This is a basic example with only 3 words.
{assign var=search_phrases value=','|explode:'home,two,three'}
{foreach from=$search_phrases item='phrase'}
{cms_selflink page=$page_alias text=$phrase urlparam='&mact=Search,cntnt01,dosearch,0&submit=submit&cntnt01searchinput='|cat:$phrase}
{/foreach}

Re: Creating a link to search for a keyword - is it possible

Posted: Thu Mar 22, 2012 10:41 am
by Andrew Prior
Peciura, that is a very cool scrap of code. Thanks!