Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-15 11:35:35

PeterJLambert
New Member
Registered: 2004-12-22
Posts: 6

Search not returning anything

Hi all,

I’m in the middle of developing a non-blog site with TXP and I’ve come across a problem I’ve not had before with Search. Basically, when you perform a search you get the page template with nothing in the content area.

I’ve had a search around the forums and it seems this has been a problem for people who didn’t have txp:article in their default page, but I do.

Could someone have a glance over the code below and see if they can spot anything that might be causeing a problem.

This is my entire default page:

<code>
<div id=“wrap”>
<div id=“header”>
<h1><a href=”/” title=“Go to the homepage”>Fastline Ltd</a></h1>
<form id=“frmSearch” name=“frmSearch” method=“get” action=”/”>
<fieldset title=“Search form”>
<label for=“txtSearch”><input type=“text” id=“txtSearch” name=“q” value=“Search the site” /></label>
<span><input type=“submit” value=“Go” id=“btnSearch” /></span>
</fieldset>
</form>
</div>
<div id=“content”>
<div id=“c1”>
<txp:if_section name=”“>
<txp:if_search>
Blah
<txp:article />
<txp:else />
<txp:output_form form=“homepage” />
</txp:if_search>
<txp:else />
<txp:article limit=“1” />
<txp:if_category name=“news”>
<txp:article_custom form=“excert” sortby=“Posted” sortdir=“desc” category=“newsitem” />
</txp:if_category>
<txp:if_category name=“recruitment”>
<txp:article_custom form=“excert” sortby=“Posted” sortdir=“desc” category=“vacancy” />
</txp:if_category>
<txp:if_category name=“OTM,small-plant,freight,transport,specialist-plant,products”>
<txp:stw_category_tree start=”*” cssid=“catlist” killempties=“true” />
</txp:if_category>
</txp:if_section>
</div>
<div id=“c2”>
<txp:output_form form=“nav” />
</div>
</div>
<div id=“footer”>
<p>&copy; All materials are copyright of Fastline Ltd, 2005</p>
</div>
</div>
</code>

As you can see, I’ve used <code><txp:if_search></code> with a <code><txp:article></code> inside. The text (“Blah”) that’s also inside the conditional shows up when a search is performed.

Oh, and I’ve tried it with the standard <code><txp:search_input /></code> and I get the same outcome.

Any advice on this would be greatly appreciated. I’m tearing my hair out.

P.S. – Apologies for the lack of code formatting. I couldn’t get Textile to apply a pre element without fucking everything else up.

Last edited by PeterJLambert (2005-11-15 12:04:58)

Offline

#2 2005-11-15 16:33:23

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Search not returning anything

Your code formatting is fine. Using “pre” tends to go off the right-hand side of the screen for me with no scrollbar. Just thought I’d mention that.

Search uses the search_results form template by default. You haven’t removed that have you?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2005-11-15 16:38:20

PeterJLambert
New Member
Registered: 2004-12-22
Posts: 6

Re: Search not returning anything

Nope. That’s still there. Haven’t even edited that.

Offline

#4 2005-11-15 16:43:13

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Search not returning anything

Try it outside the “if_section” tags.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2005-11-15 17:00:32

PeterJLambert
New Member
Registered: 2004-12-22
Posts: 6

Re: Search not returning anything

It’s not happening. Took it out of all conditionals, even tried it without the <code><txp:if_search></code> and still get the same result.

Offline

#6 2005-11-15 21:16:16

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Search not returning anything

Are the necessary sections set to Include in site search under presentation > sections? Sure you’re searching for a word that exists? Try a few, and see if case makes a difference.


Alex

Offline

#7 2005-11-15 23:03:57

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Search not returning anything

I added a few other suggestions to the FAQ.


Alex

Offline

#8 2005-11-16 09:10:55

PeterJLambert
New Member
Registered: 2004-12-22
Posts: 6

Re: Search not returning anything

I don’t believe it! It was the words I was searching for.

Shouldn’t it return a “No results found” message if nothing is returned though?

Offline

Board footer

Powered by FluxBB