Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Surpress search_result_excerpt when empty?
In my search results form I have the following:
<p class=“search_excerpt”><txp:search_result_excerpt /></p>
This works fine most of the cases, but where the result_excerpt is empty (because the search term is in the title for instance), an empty paragraph is displayed.
Is there any way to suppress this? <txp:search_result_excerpt /> doesn’t have a wraptag or anything…
Doug.
Offline
#2 2011-07-07 10:57:55
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Surpress search_result_excerpt when empty?
You were the guy who didn’t think of plugins, were you? I won’t mention chh_if_data to you ;)
Instead you can use core tags:
<txp:variable name="result_test" value='<txp:search_result_excerpt />' />
<txp:if_variable name="result_test" value="">
<!-- do nothing -->
<txp:else />
<p class="search_excerpt"><txp:search_result_excerpt /></p>
</txp:if_variable>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Surpress search_result_excerpt when empty?
Yeah I’m that guy!
Thanks again. Got to remember txp:variable now too…
Doug.
Offline
Re: Surpress search_result_excerpt when empty?
There’s also the <txp:if_search_results>
tag
<txp:if_search_results>
<p class="search_excerpt"><txp:search_result_excerpt /></p>
<txp:else />
</txp:if_search_results>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline