Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#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?
Thanks
Rich
you can test it here:
http://oh.krd-design.net/blog/
Last edited by richtestani (2010-03-01 16:50:44)
Offline
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
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
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
Pages: 1