Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-10-26 16:18:27
- glenelkins
- Member
- Registered: 2008-08-28
- Posts: 29
if_search_results doest work!
Hi
this doesnt work:
<txp:if_search_results>
<div class=“actorThumb”> <txp:permlink><txp:article_image style=“width: 85px; height:107px;” /></txp:permlink> <div class=“actorDesc”><txp:permlink><txp:title /></txp:permlink></div> </div><txp:else />
<p>Sorry there were no results matching your search</p>
</txp:if_search_results>
when there are no results it doesnt display the message after the else
Offline
Re: if_search_results doest work!
glenelkins wrote:
when there are no results it doesnt display the message after the else
In what context are you using the tag on your page? Do you have a <txp:article />
tag first (perhaps with the pgonly="1"
attribute). See the if_search_results tag reference, pay attention to the ‘important’ note and check out example 2 there for more info.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2009-10-26 16:31:35
- glenelkins
- Member
- Registered: 2008-08-28
- Posts: 29
Re: if_search_results doest work!
well no it just submits the textpattern search form to /search_results
Offline
Re: if_search_results doest work!
glenelkins wrote:
well no it just submits the textpattern search form to /search_results
Hmmm, then in order for the if_search_results to work you will need a second article tag (if you’re redirecting the search to a section other than the home page you may need some additional jiggery pokery, but I’m not sure as I’ve never done it).
This tip shows a mechanism for doing it, as does using the non-default section. If you do it that way and add the extra article tag, does it help?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2009-10-26 22:47:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_search_results doest work!
Something like this?
<txp:if_search>
<txp:article pgonly="1" />
<txp:if_search_results>
<txp:article>
<div class="actorThumb">
<txp:permlink><txp:article_image style="width: 85px; height:107px;" /></txp:permlink>
<div class="actorDesc"><txp:permlink><txp:title /></txp:permlink></div>
</div>
</txp:article>
<txp:else />
<p>Sorry there were no results matching your search</p>
</txp:if_search_results>
</txp:if_search>
Offline
Pages: 1