Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Passing search term to search results

Quote Reply
Passing search term to search results
Hello,

In search_results.html I've changed:

<p>Your search returned <b><%cat_hits%></b> categories and <b><%link_hits%></b> Links.

to:

<p>Your search for <b>"<%query%>"</b> returned <b><%cat_hits%></b> categories and <b><%link_hits%></b> Links.

This works great when there are search results, but the search term is not passed if no links are found. The only place I could find "No Matching Links" is in the language.txt file in the line:

'SEARCH_NOLINKS' => 'No Matching Links.',

I've tried changing this to:

'SEARCH_NOLINKS' => 'No Matching Links for <%query%>.',

...and to:

'SEARCH_NOLINKS' => 'No Matching Links for ${'query'}.',

...and to:

'SEARCH_NOLINKS' => 'No Matching Links for \'%query\'.',

...I've also tried a host of other incorrect code. Since this is a text file, it's obvious that my syntax is wrong.

Am I even looking at the correct file to alter? Anyone know how I can accomplish this?

Thanks
Quote Reply
Re: [ronzo] Passing search term to search results In reply to
In your search.html template you have <%if error%>...Something...<%endif%>. This is what will be displayed if you do not have any search results and you can use <%query%> within this.
Quote Reply
Re: [afinlr] Passing search term to search results In reply to
Thanks Laura! Found it and that did the trick.
Quote Reply
Re: [afinlr] Passing search term to search results In reply to
afinlr wrote:
In your search.html template you have <%if error%>...Something...<%endif%>. This is what will be displayed if you do not have any search results and you can use <%query%> within this.

Hm, the <%if error%>...Something...<%endif%> thing in search_results.html, does not work in Links 3.2 anymore.
Is there another way to show a message in search_results.html beside the "SEARCH_NOLINKS" message, when there are no results?

I even tried <%if SEARCH_NOLINKS%> ...Something... <%endif%> but there is no output :-(

Thanks
Matthias


Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Passing search term to search results In reply to
It never has. It only applied to search.html. When there are no search results, you get sent back to search.html, not search_results.html

Adrian
Quote Reply
Re: [brewt] Passing search term to search results In reply to
Upps, must have been blind.
Thanks
Matthias

Matthias
gpaed.de