Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-14 19:16:16

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 811
Website

I can't get if_search_results working ...

… especially the <txp:else /> part … !?

I follow these steps according > www.justinfrench.com

I’m using > <txp:output_form form="search_input" /> on the pages

I have a section and a page called ‘search’

The form search_input:

<form action="<txp:site_url />index.php" method="get">
<input type="hidden" name="s" value="search" />
<input type="text" name="q" value="" size="20" />
<input id="search" src="<txp:site_url />design/search.gif" type="image" value="Gaon!" />
</form>

The form search_results:

<txp:if_search_results>
<div class='search_result'>
<p class='posted'>Gevonden in: <txp:search_result_title /></p>
<p>"<txp:search_result_excerpt limit="99" hilight="strong" break="&hellip;" />"</p>
</div> 
<txp:else />
<div class='search_result'>
<p class='posted'>De zoekterm <strong><txp:search_term /></strong> heeft geen resultaten opgeleverd.</p>
</div>
</txp:if_search_results>

Try for yourself at > www.dorpshuiswapse.nl (under construction!)

Last edited by RedFox (2009-12-14 19:21:20)

Offline

#2 2009-12-14 19:18:08

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: I can't get if_search_results working ...

Seems to work for me


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-12-14 19:24:22

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 811
Website

Re: I can't get if_search_results working ...

MattD wrote:

Seems to work for me

Hi MattD … yes, I know, but what if you put no character(s) at all into the searchbox and then hit ‘gaon!” Where is “De zoekterm <strong><txp:search_term /></strong> heeft geen resultaten opgeleverd.” … ?

Last edited by RedFox (2009-12-14 19:26:35)

Offline

#4 2009-12-14 19:26:35

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: I can't get if_search_results working ...

How/where are you calling the form “search_results”?
You have to use the searchform attribute on txp:article tag.
Like this: <txp:article searchform="search_results" />.

Also, you will probably have to include a txp:article pgonly="1" tag in your search page template, before the if_search_result, so Textpattern knows that there are (or not) search results.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-12-14 19:34:16

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 811
Website

Re: I can't get if_search_results working ...

Hi maniqui … according the mentioned article it isn’t needed. Nevertheless I tried, but it doesn’t work either!

Offline

#6 2009-12-14 19:49:06

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: I can't get if_search_results working ...

maniqui is correct – check Textbook always if in doubt…see this post of mine from a few days back for a code example, or check some other articles..

Offline

#7 2009-12-15 13:09:48

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 811
Website

Re: I can't get if_search_results working ...

Offline

Board footer

Powered by FluxBB