Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-10-18 04:25:25
- axelheyst
- Member
- Registered: 2006-10-18
- Posts: 12
Blank Search Results
So when I run a search I can get the:
[txp:search_result_count text=“Hits” /]
to return a number (i.e 4 or 5) but no search results appear on the form.
Here is the page: http://www.dumic.org
The search is on the left.
Here is some of my code on my default page in the TXP admin:
UPDATED click here to see code
(The search part of the code is right after [div id=“righter”])
Thanks for any help!
Last edited by axelheyst (2006-10-18 04:46:47)
Offline
Re: Blank Search Results
Based off of this aricle, you can try:
<txp:if_search>
<txp:article status="live" limit="0" pageby="1" />
<h2>
<txp:php>
global $thispage;
global $q;
if ($thispage['total']==0) {
echo 'No results were found for “'.$q.'”';
}
else {
echo 'Search: '.$thispage['total'].' result(s) for “'.$q.'”';
}
</txp:php>
</h2>
<div id="content">
<txp:article form="search_results" limit="999" />
</div>
</txp:if_search>
Last edited by jm (2006-10-18 04:34:55)
Offline
#3 2006-10-18 04:36:03
- axelheyst
- Member
- Registered: 2006-10-18
- Posts: 12
Re: Blank Search Results
Just tried that, still getting no results with a positive integer after the results counter.
On a side note, how did you get HTML and TXP code to show up in your post. Thanks :)
Offline
#4 2006-10-18 04:49:15
- axelheyst
- Member
- Registered: 2006-10-18
- Posts: 12
Re: Blank Search Results
To clarify, this is not a post about showing users some sort of “No Results Found” message. I actually am not getting any results to display when I run a search where it shows I HAVE results. (By “it shows” I mean using the [txp:search_result_count text=“Hits” /] tag).
Again, here is the code:
click here to see code
Thanks all!
Last edited by axelheyst (2006-10-18 04:49:31)
Offline
Re: Blank Search Results
I know, that was just the most accessible piece of working code (for me).
Things to try:
- Put your site into debugging mode (Admin>Prefs) – do any errors come up?
- I think that the
<txp:if_article_list>
before<txp:glx_if_search>
is causing the problem. Move all the non-default templating to another template (copy), and move your standard HTML to forms to simplify and declutter.
page: default
<txp:output_form form="header" />
<txp:if_search>
<h1>Search Results</h1>
<txp:search_result_count text=?Hits? />
<txp:article form="search_results" /><!--does your default form have provisions for search results?-->
</txp:if_search>
<txp:glx_if_frontpage>
<h1>Homepage</h1>
<!--
Consider using a sticky article:
http://textpattern.com/faq/84/how-do-i-keep-a-post-at-the-top-of-the-page
-->
</txp:glx_if_frontpage>
<txp:output_form form="footer" />
form: header
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="<txp:css />" type="text/css" media="screen,projection" />
<title><txp:ob1_title order="%article,%section,%sitename" separator=" | "/></title>
<script src="/mint/mint.js.php" type="text/javascript" language="javascript"></script>
</head>
<body>
<div id="cont">
<div id="main">
<div id="header">
<img src="/header_images/rotator.php"></img>
</div>
<div id="textpattern_content">
<div id="lefter">
<h1>Links</h1>
<!--consider using an unordered list <ul>, and perhaps <txp:linklist /> and <txp:section_list />-->
<h1>Search</h1>
<txp:search_input label="" button="Find It!" size="25" />
<p><a href="/search">Advanced Search</a></p>
<h1>The Catalog</h1>
<p>This catalog site is designed so that it can be searched by keyword, collection, type of instrument, and date. It contains information on instruments in the possession of Duke University, with the exception of modern practice and performance pianos.</p>
<p><a href="http://dumic.org/catalog">Read more</a></p>
<h1>Modern Orchestral System</h1>
<txp:linklist form="Links" category="Modern-Orchestral-System" />
<h1>Hornbostel-Sachs</h1>
<txp:linklist form="Links" category="Hornbostel-Sachs" />
<h1>The Collections</h1>
<txp:linklist form="Links" category="Collections" />
</div><!--//lefter-->
<div id="righter">
form: footer
</div><!--//righter-->
</div><!--//textpattern_content-->
<div id="clearer"></div>
</div><!--//main-->
<div id="footer"></div>
</div><!--//cont-->
</body>
</html>
- You don’t need to serve the content-type meta tag—Textpattern sends out the appropriate header with PHP.
- You can post your code with
bc.
– Posting Code
Offline
#6 2006-10-18 13:08:08
- axelheyst
- Member
- Registered: 2006-10-18
- Posts: 12
Re: Blank Search Results
Thank you. I am going to try this.
Offline
Pages: 1