Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-01 04:59:09

dreamer
Member
Registered: 2007-06-08
Posts: 242

Can't get my search bar to work.

I’m having issues with having my search bar returning results— it’s returning anything. This is my site here

This is the line of code that outputs in my ‘searchpage’ page

<h1>Search Results</h1>
<txp:article searchform="search_results" />

This is my search_results form

<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:posted /></p>
<p style="padding-bottom:20px;"><txp:search_result_excerpt /></p>

Thoughts?

Last edited by dreamer (2008-05-01 05:04:50)

Offline

#2 2008-05-01 08:47:07

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Can't get my search bar to work.

the error says it all:)

Textpattern Notice: Page template homepage does not contain a txp:article tag on line 474

You should add something like

<txp:if_search>
<txp:article />
</txp:if_search>

in your template(s)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2008-05-01 13:39:26

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Can't get my search bar to work.

In addition to colak’s reply: your code

<h1>Search Results</h1>
<txp:article searchform="search_results" />

does have an article tag, so the fact that you still get that error means that the search results are using the wrong page template. I notice you have a section search, so you need to use the section attribute in the search_input tag, otherwise the search results are displayed on the front page.

Last edited by els (2008-05-01 13:40:18)

Offline

#4 2008-05-01 15:23:12

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: Can't get my search bar to work.

Els-

Okay, so the problem that I have with that is I created a form called search_input. And my other forms would call this form.

Usually I would just put that tag into the page templates but I had to do it differently this time. Hence, I can’t add the section attribute to the search_input tag into my page template because my code for the search_input form looks like this;

<form id="myform" method="get" action="http://www.sourcetosummit.com/">
<p><input type="text" name="q" value="" size="25" /><input type="submit" value="search site" /></p>
</form>

Thus, I can’t do something as simple as

<txp:search_input label="Search" button="Search" size="15" wraptag="p" />

and put this inside my page templates.

Offline

#5 2008-05-01 15:38:44

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Can't get my search bar to work.

Do this:

<form id="myform" method="get" action="/search/">

Last edited by els (2008-05-01 15:40:38)

Offline

Board footer

Powered by FluxBB