Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-03-01 16:50:10

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Search finds all articles

I’ve setup a search box on this sites blog page, and some strange things I can’t seem to figure out.

1) The search looks at all articles, even not in its section.
2) My styles for the sidebar are gone (partially), does this mean the template is different?

Any ideas on the causes here? The blog does use an article tag (not article_custom)

Thanks
Rich

you can test it here:
http://oh.krd-design.net/blog/

Last edited by richtestani (2010-03-01 16:50:44)

Offline

#2 2010-03-02 15:04:54

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

Re: Search finds all articles

The search box is meant to be site-wide. You can modify it’s behaviour by going to the “Sections” tab and changing the “Include in site search” option to “No” for those sections that you don’t want searched.


Stuart

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

Offline

#3 2010-03-02 16:26:04

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Search finds all articles

TXP search results are, by default, displayed in the “default” page template, inside the <txp:article /> tag. The content of any sidebar, including css styles, reflect that.

You can exert control over how search results are displayed in the default page template with the txp tag <txp_if_search > and <txp_if_search_results>

There is an elderly but still good article on building a customized search results page here.

Offline

#4 2010-03-03 17:02:36

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

Re: Search finds all articles

Or you could give the search it’s own section and page template by changing your searchform code to something like:-

<form id="searchForm" method="post" action="<txp:site_url />search/">
<p><input id="searchInput" type="text" name="q" value="" size="25" /><input id="searchButton" type="submit" value="Go" /></p>
</form>

HTML formatting is up to you but note how the “action” attribute for the form is sending the results to the “search” section. If you give that section it’s own template you can copy the one being used by the blog and just modify the tags in the main content area to output the results. These should use the “search_results” template by default so modify that to display the articles in the search results to the way you want to see them. Everything else about the page should match your blog page as it is identical code.


Stuart

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

Offline

Board footer

Powered by FluxBB