Gossamer Forum
Quote Reply
Tag Tip!
To get "Your search for <%query%> returned <%cat_hits%> and <%link_hits%>!" to be more aesthetically pleasing, use the following tags in search_ results.html

<small>Your search for<b> <%query%> </b>returned
<%if cat_hits%>
<strong><%cat_hits%></strong> Categories and
<%endif%>

<%if link_hits%>
<strong><%link_hits%></strong> Link(s).</small>
<%endif%>

This prevents something like this showing..
Your search for music returned 0 Categories and 1 link!

..it will just show (if there are no Category hits)...
Your search for music returned1 link(s)!



Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Tag Tip! In reply to
Building on that...you can also use criteria expressions for the correct grammar....

Code:

<%if cat_hits gt 1%>
<%cat_hits%> Categories
<%endif%>
<%if cat_hits = 1%>
<%cat_hits%> Category
<%endif%>
<%if link_hits gt 1%>
<%link_hits%> Links
<%endif%>
<%if link_hits = 1%>
<%link_hits%> Link
<%endif%>


Regards,

Eliot Lee
Quote Reply
Re: Tag Tip! In reply to
Ahhhh thanks for that....I had been trying to figure out how to get the correct grammar for ages but had no luck!

I was trying to use this

<% if cat_hits && link_hits%>
bla bla
<%endif%>

Anyway..you cleared that up...thanks!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Tag Tip! In reply to
And...

You can add a IFNOT statement so that you can also have a resonse if there are NO hits!

I LOVE all the possibilities!

dave

Quote Reply
Re: Tag Tip! In reply to
Thats what I have done on my category pages....

<if link_results%>
<%link_results%>
<%endif%>
<%ifnot link_results%>
There are no links in this category yet so why not change this by adding a resource!
<%endif%>

...you can use that theory on all pages like whats cool, whats new etc..to display messages if there are no results!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)