Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-13 15:44:13

intuitive
Member
From: Spain
Registered: 2006-06-06
Posts: 22
Website

how do I display a certain number of search results?

I need just a basic search function on my site, so I am using this: <txp:search_input label=”“ button=“Search” size=“15” />

However, it just displays the first 10 results. Does anyone know of a way to change this number or display all of the results at once? Or having a pagination would be fine as well.

Thanks!

Offline

#2 2006-06-13 18:49:45

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

Re: how do I display a certain number of search results?

Search results are powered by the article tag. You can use the limit attribute to change how many are shown per page, and the older and newer tags for next and previous. (We should actually have proper prev and next tags, but at the moment, we don’t).

Offline

#3 2006-06-13 20:08:02

intuitive
Member
From: Spain
Registered: 2006-06-06
Posts: 22
Website

Re: how do I display a certain number of search results?

it works! Thanks, Mary!

Offline

#4 2006-07-11 18:29:40

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

Re: how do I display a certain number of search results?

Mary:

Thanks for the above information, but I am having a little trouble getting a previous and next to work …

The below code works great

<code><txp:if_category name=“3600_to_4500_sq_ft”>
<txp:article_custom category=“3600_to_4500_sq_ft” limit=“5” sortby=“Posted”/>
</txp:if_category></code>

but I am unable (or better yet) uncertain where the newer and older tags go to get the next and previous action working. No matter where I put it, it does not seem to appear.

Your assistance would be greatly appreciated.

Thanks.

Last edited by progre55 (2006-07-11 18:30:22)

Offline

#5 2006-07-11 19:40:30

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

Re: how do I display a certain number of search results?

Paging tags don’t work for article_custom, it always results in exactly one list. But, you don’t need it anyway:

<txp:if_category name="3600_to_4500_sq_ft">
<txp:article limit="5" sortby="Posted" />
</txp:if_category>

:)

Last edited by Mary (2006-07-11 19:41:02)

Offline

#6 2006-07-11 19:44:21

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

Re: how do I display a certain number of search results?

Mary:

I guess I am confused. If I have limited the results to 5 articles, but I have 25 articles total in the catagory, how do I get a next page navigation to appear after the first 5 results?

When I use your revised code, nothing displays for results.

Thanks.

Last edited by progre55 (2006-07-11 19:49:13)

Offline

#7 2006-07-11 20:04:35

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

Re: how do I display a certain number of search results?

Put in some older and newer tags. :)

Offline

#8 2006-07-11 20:09:42

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

Re: how do I display a certain number of search results?

Mary:

I tried that and no matter where I put in the older and newer tags … nothing displays in the search results …

Can you guide me on where the tags would go on my original code, since like I said the code you revised does not display anything ..

Again your assistance is much appreciated …

Randy

Last edited by progre55 (2006-07-11 20:13:36)

Offline

#9 2006-07-11 20:22:35

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

Re: how do I display a certain number of search results?

Okay, you’ve got me a little confused. The tags you’ve posted are for categories, not search results.

Can you show me what you’re currently using for your front page? Did you only want the nav links for search results and category lists, or do you want them all the time?

Offline

#10 2006-07-11 20:30:53

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

Re: how do I display a certain number of search results?

Mary:

I sometimes have that effect. Sorry. Hopefully this sheds light on what is going on.

Originally, on my home page I wanted a pull down displaying specific article categories. With the assistance of Nels, I have come to the conclusion, that I am unable to get that, but can achieve a list of specific categories using the following code (hard coded) on my home page:

<code><a href=”<txp:site_url /><txp:section name=“cat_search_2500” />/?c=<txp:category name=“2500_to_3500_sq_ft” />”><txp:category wraptag=“li” title=1 name=“2500_to_3500_sq_ft” /></a><BR><BR>
<a href=”<txp:site_url /><txp:section name=“cat_search_3600” />/?c=<txp:category name=“3600_to_4500_sq_ft” />”><txp:category wraptag=“li” title=1 name=“3600_to_4500_sq_ft” /></a></code>

Once they select the appropriate category, they are directed to a section that shows them their search results. I am using this code for that:

<code><txp:if_category name=“3600_to_4500_sq_ft”>
<txp:article_custom category=“3600_to_4500_sq_ft” limit=“5” sortby=“Posted”/>
</txp:if_category></code>

From their, they can select one of the article results that redirects them to a new section and gives them further detail.

The problem is, I want to limit the results, but allow them to view all the results if they want by using a “Next or Previous” option.

I hope this clarefies things.

Offline

#11 2006-07-12 01:56:46

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

Re: how do I display a certain number of search results?

Okay, just do:

<a href="<txp:site_url />cat_search_2500/?c=2500_to_3500_sq_ft"><txp:category name="2500_to_3500_sq_ft" title="1" /></a><br /><br />
<a href="<txp:site_url />cat_search_3600/?c=3600_to_4500_sq_ft"><txp:category name="3600_to_4500_sq_ft" title="1" /></a>

and:

<txp:if_category name="3600_to_4500_sq_ft">
<txp:article sortby="Posted" limit="5" />

<p><txp:older>Prev</txp:older> · <txp:newer>Next</txp:newer></p>
</txp:if_category>

You were using some tags there that you didn’t need too. :)

Offline

#12 2006-07-12 02:04:07

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

Re: how do I display a certain number of search results?

Mary:

Sorry to be a pain.

The first part of the code you gave me works fine and directs me to the right area, BUT

The second part of the code only shows me a the “.” It does not show me the search results, nor does it show me the previous or next text …

Any thoughts …

Last edited by progre55 (2006-07-12 02:05:22)

Offline

Board footer

Powered by FluxBB