Photo of Jamie & Lion

The personal site of Jamie Knight, an autistic web developer, speaker and mountain biker who is never seen far from his plush sidekick Lion. View the Archive

Topics: Autism Development

Blank out there for a sec

Whilst redesigning the site i came across what seem to be a common problem with the textpattern CMS The blank page returned by a search with no results. So i tried to find a fix.

With a little bit of searching around, and a quick trip to the amazing textbook website i quickly found a plug-in which claimed to fix my little blank page problem.

The plug-ins name is rss_if_search_results and is another one of the great wilshireone.com plugins.

At first, this plug in seemed perfect for what i needed, It promised to alow me to display a useful message when no search results were returned, however, for some reason i was unable to get this to work.
After a little more experimenting i found the chh_if_data plug in and this post describing its use. The implementation of this plug in was not quite as obvious as the other plug in, so i feel the need to share the code ( love )

After installing the plug-in, go to you default page, and place the following code into the place you wish the search results or message to be displayed.

<txp:if_search>
<txp:chh_if_data>
<p>Here’s an article list containing your search inquiry</p>
<txp:article />
<txp:else />
<p>No articles found</p>
</txp:chh_if_data>
</txp:if_search>

A nice touch when using the above form with the message displayed when results are found would be to edit the form named search_results to:

<p><txp:search_result_title ></p>

With this method in place, the blank screen when there is no search results is resolved.

Published: 18 February 2007 | Categories: , Permalink

Commenting is closed for this article.