Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Search Page
How do I get it so say they search for something, and they have no results, and I want to put something saying this. I’ve tried adding a txp else tag to the search_results form, but no luck :S
~ Cameron
Offline
Re: Search Page
Hint: there are several other search related tags (see Textbook)
Offline
#18 2008-09-15 22:10:44
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Search Page
Offline
Re: Search Page
These are only ones i see :S
<txp:search_input />
<txp:search_result_count />
<txp:search_result_date />
<txp:search_result_excerpt />
<txp:search_result_title />
<txp:search_result_url />
<txp:search_term />
~ Cameron
Offline
Offline
Offline
Re: Search Page
Okies, I have this so far, but even WHEN they have a legitimate search it’s still saying Sorry…
<txp:if_search>
<p style="font-size:2.5em;">You searched for: <txp:page_url type="q" /></p>
<txp:else />
<p>begin searching by typing in the search box in the top right corner</p>
</txp:if_search>
</div>
<div id="body">
<div id="maincontent" style="width:980px;">
<div class="innerBlocks">
<txp:if_search_results>
<p>These articles match your search request: </p>
<txp:else />
<p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
</txp:if_search_results>
<txp:if_search>
<txp:article form="search_results" sort="Section asc" />
<txp:else />
<p>No Content Available...</p>
</txp:if_search>
~ Cameron
Offline
#23 2008-09-15 22:20:33
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Search Page
Honestly, do you ever take some time to read?
Edit: sorry, spoke too soon :(
I think you need only one set of if_search tags, wrap that entire block of code in it.
Last edited by els (2008-09-15 22:25:08)
Offline
Re: Search Page
Els wrote:
-Honestly, do you ever take some time to read
What? :S How does those attributes change anything? They’re for the max and min only right, unless I’m missing something, please explain. x
~ Cameron
Offline
#25 2008-09-15 22:25:46
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Search Page
Edited my post.
Offline
Re: Search Page
Urgh I’m super confused now, which tags am I using here :S
I have the if_search to detect if we are searching or not, ie you have searched or are just on the search page
and I have the if_search_results to detect if we have search results or not and show either a yes or no answer
Which one needs wrapping inside the other (if at all).
Thank you
~ Cameron
Offline
Re: Search Page
Not sure why it isn’t working, but for clarity, I would write the last part of your code as this:
<txp:if_search>
<txp:if_search_results>
<p>These articles match your search request: </p>
<txp:article form="search_results" sort="Section asc" />
<txp:else />
<p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
</txp:if_search_results>
<txp:else />
<p>No Content Available...</p>
</txp:if_search>
Offline
Re: Search Page
okies, now the search ALWAYS says no results were found (it doesnt display them either) :P
there are several articles called Lorem Ipsum, and here is a test search: http://www.simplecandy.com/search?q=lorem+ip
But the results don’t show :S
Last edited by driz (2008-09-15 22:56:21)
~ Cameron
Offline
#29 2008-09-15 23:04:08
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Search Page
We forgot to tell you about pgonly: just put <txp:article pgonly="1" /> before the if_search_results tag. It doesn’t display anything but it is needed to count the articles.
<txp:if_search>
<txp:article pgonly="1" />
<txp:if_search_results>
<p>These articles match your search request: </p>
<txp:article form="search_results" sort="Section asc" />
<txp:else />
<p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p>
</txp:if_search_results>
<txp:else />
<p>No Content Available...</p>
</txp:if_search>
Offline
Re: Search Page
Out of curiosity, how many be default (search links) will be displayed and do they have pagination?
And the code changed fixed the bug, cheers :) x
Last edited by driz (2008-09-15 23:10:19)
~ Cameron
Offline