Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-20 19:47:12

progre55
Member
Registered: 2006-05-02
Posts: 668

Search and the Default Page

I know that when I do a search, the results appear on the default page. At this time it is my understanding I can not change this to redirect to another section. SO, my question is this …

On a home page for this client I have a listing of articles on the left and the search box on the right.

The code I am using to create the listing of articles is:

<code><txp:if_article_list>
<txp:article_custom form=“magazine” category=“magazine” sortdir=“asc” limit=“5” />
</txp:if_article_list></code>

My issue is, when people do a search, I want the current list of articles to disappear and the search results appear.

Any and all assistance would be appreciated.

Thank you.

Offline

#2 2006-07-20 19:49:48

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Search and the Default Page

It’s because you’re using article_custom. Do:

<txp:if_article_list>

	<txp:if_search>

		<txp:article />

	<txp:else />

		<txp:article_custom category="magazine" sortdir="asc" limit="5" form="magazine" />

	</txp:if_search>

</txp:if_article_list>

:)

Offline

#3 2006-07-20 19:53:02

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Search and the Default Page

Mary:

YOU ARE GREAT. THANKS.

Thanks.

P.S. I know we have been going back and forth on another issue, I have put it aside for the moment, but will be sending you probably some more feedback in the next couple of days.

Offline

#4 2006-07-20 21:57:45

NNF
Member
Registered: 2006-02-27
Posts: 13

Re: Search and the Default Page

progre55 wrote:

I know that when I do a search, the results appear on the default page. At this time it is my understanding I can not change this to redirect to another section.

Actually, you can! The trick is to not use the built-in search form, but your own. I myself created a form called “searchform”, with the following content:

<form action="http://www.evatec.info/search/" id="searchform" method="get">
	<fieldset>
		<legend>search our website</legend>
		<input type="text" name="q" value="" size="20" />
		<button type="submit" value="Search">Search</button>
	</fieldset>
</form>

Note the form action. Then, all you have to do is call it like this: <code><txp:search_input form=“searchform” /></code> and you’re set.

Last edited by NNF (2006-07-20 22:01:44)

Offline

#5 2006-07-21 01:35:33

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Search and the Default Page

NNF:

Great suggestion, tested it out and it worked. I had been looking for something like this for awhile. I should have posted my question earlier.

Now I have two methods (one on the default page and one on another section) which I am sure will come in handy in the future.

Thanks again.

Randy

Last edited by progre55 (2006-07-21 01:36:37)

Offline

#6 2006-07-21 15:51:50

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Search and the Default Page

Mary:

I also wanted to get my categroy list to appear on the home page.

I revised the code like this:

<CODE><txp:if_article_list>

<txp:if_search>

<txp:article sortdir=“asc” sortby=“Title” searchall=“0” />

<txp:else />

<txp:if_category>

<txp:article sortdir=“asc” sortby=“Title” searchall=“0” />

<txp:else />

<txp:article_custom category=“magazine” sortdir=“asc” limit=“5” form=“magazine” />

</txp:if_search>

</txp:if_article_list></CODE>

But when I select the category I do not see any results, I just see my original index page.

Last edited by progre55 (2006-07-21 15:52:48)

Offline

#7 2006-07-22 00:21:52

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Search and the Default Page

<txp:if_category>

	<txp:article sortby="Title" sortdir="asc" />

<txp:else />

	<txp:article_custom category="magazine" sortdir="asc" limit="5" form="magazine" />

</txp:if_category>

Is there live articles in that category? Are the sections for those articles set to display on the front page?

Offline

#8 2006-07-22 01:51:38

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Search and the Default Page

Mary:

Thanks for you assistance, but I figured out a different method to get the result I was looking for, so I do not want to waste your valuable time on this one.

Thanks again for all the assistance.

Randy

Last edited by progre55 (2006-07-22 01:52:14)

Offline

Board footer

Powered by FluxBB