Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-04-10 17:10:45
- jim_01
- Member
- Registered: 2008-01-17
- Posts: 35
Search results
If my search results don’t find anything currently it is just displaying a blank article, how can I make it say “No results found”.
Thanks!
Offline
Re: Search results
Try the if_search_results conditional tag.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Search results
Rather than start a new thread, I searched and found this thread, so I’ll just post here:
I’m using the following txp code to prepare for search results and a lack of search results, but I always get a TXP error that says it can’t find an article. When I delete the if_search_results portion, it works fine, but obviously won’t show any helpful text if no results were found.
<txp:if_search>
<h2>Search Results:</h2>
<txp:if_search_results min=“1”>
<txp:article searchform=“search_results” />
<txp:else />
<p>Sorry, no results were found. Try again with a different term.</p>
<txp:else />
<txp:article allowoverride=“1” form=“welcome” pgonly=“0” sort=“Posted asc” status=“4” />
</txp:if_search>
Any one have any ideas?
Last edited by surfwax95 (2008-04-18 19:45:39)
Caps lock is cruise control for cool. —Unknown
Offline
Re: Search results
<txp:article pgonly=“1” />
<txp:if_search>
<h2>Search Results:</h2>
<txp:if_search_results min=“1”>
<txp:article searchform=“search_results” />
<txp:else />
<p>Sorry, no results were found. Try again with a different term.</p>
<txp:else />
<txp:article allowoverride=“1” form=“welcome” pgonly=“0” sort=“Posted asc” status=“4” />
</txp:if_search>
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Search results
Thanks, the_ghost.
Your suggestion didn’t work for me, but when I put the <txp:article pgonly=“1” /> inside the if_search, it worked perfectly.
Caps lock is cruise control for cool. —Unknown
Offline
Re: Search results
Actually both of the code examples above are incorrect so you may have problems further down the line as there is no closing tag for <txp:if_seacrh_results>
so it needs to be something like:-
<txp:if_search>
<txp:article pgonly="1" />
<h2>Search Results:</h2>
<txp:if_search_results min="1">
<txp:article form="search_results" />
<txp:else />
<p>Sorry, no results were found. Try again with a different term.</p>
</txp:if_search_results>
<txp:else />
<txp:article allowoverride="1" form="welcome" pgonly="0" sort="Posted asc" status="4" />
</txp:if_search>
Just thought I should point that out. :)
Last edited by thebombsite (2008-04-19 09:14:49)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Pages: 1