Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-24 23:08:30

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

two questions about search results page

1. When I use the <txp:search_result_excerpt /> tag in my search results page, is it not suppose to show a small excerpt/preview of the article? When I do a test search and type in a a keyword that is in the title of one of my articles, all that shows is the title of the article and the permlink, not preview or excerpt of the actual article. Maybe I’m taking this tag the wrong way? Here is the form I’m using for the results:

<code>
<h4><txp:permlink><txp:title /></txp:permlink></h4>
<div class=“search_results”>
<p><txp:search_result_excerpt /><br/>
<small><txp:permlink><txp:permlink /></txp:permlink> &middot;
<txp:posted format=”%b %d, %Y” /></small>
</p>
<br />
</div>
</code>
<br/>

2. Second question is how to limit the results to a certain number like 5 per page and then at the bottom of the results page, have something like “Page: 1 | 2 | 3 | 4 | 5” for more results? Is that possible? I tried to use <txp:older /><txp:newer/> but it did nothing. I tried adding it to my page template and my search resutls form and no luck with either.

Thanks

Offline

#2 2006-09-25 09:36:39

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

Re: two questions about search results page

For #1: the purpose of the excerpt is to give a preview of the context of where the keyword(s) appear in the article body/except, so that’s why you’re not getting anything back.

This could be confusing, depending upon your site audience, in which case, you can take a plugin and do something like:

<txp:chh_if_data>
	<txp:search_result_excerpt />
<txp:else />
	Keyword(s) do not appear in the article body.
</txp:chh_if_data>

For #2: that is, currently, another plugin you would need. :)

Offline

#3 2006-09-25 12:29:43

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: two questions about search results page

Ohh, I see what you’re saying. I already am using the chh_if_data plugin to display “No Results were found” message when nothing matches the search criteria by doing this:

<code>
<txp:if_search>
<txp:chh_if_data>
<txp:article />
<txp:else />
<p>Your search returned no results.</p><br />
<p>Please try again.</p>
</txp:chh_if_data>
</txp:if_search>
</code>
<br />
So, I don’t think I can use <txp:search_result_excerpt /> in there as well as <txp:article /> right?
<br />
Last question about this is that if you go to my site: <a href=“http://www.kentuckygolfing.com”>Kentucky Golfing</a> and just type in “Lorem ipsum” (since all three test articles on the homepage have that in them) in the search bar and then search, you’ll see that all the articles containing “Lorem ipsum” show up in the results, but only the first link/search result at the top shows the expert containing the keywords. Is that right?

Thanks Mary

Last edited by deronsizemore (2006-09-25 12:30:30)

Offline

#4 2006-09-25 12:37:17

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

Re: two questions about search results page

That’d go in your article form, not on the page, so it should still work.

Is that right?

No, it’s not, that shouldn’t be happening.

Offline

#5 2006-09-25 14:43:45

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

Re: two questions about search results page

deronsizemore wrote:

I tried to use <txp:older /><txp:newer/> but it did nothing. I tried adding it to my page template and my search resutls form and no luck with either.

<txp:older> and <txp:newer> (on the page template) are working for me on my search results page. Did you put them after the article tag?

Offline

#6 2006-09-25 18:42:15

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: two questions about search results page

Mary wrote:

No, it’s not, that shouldn’t be happening.

Mary,

Here is my form code for my search results. I can’t see anything that I’m doing wrong for the search result excerpt to only be displaying for the first search result to show the excerpt and for the others to ignore it. I don’t know if your more trained txp eye can pinpoint something or not….but here is my code that I’m usings.

FORM Code:

<code>
<h4><txp:permlink><txp:title /></txp:permlink></h4>
<div class=“search_results”>
<p><txp:search_result_excerpt /></p>
<span class=“search_results_link”><txp:permlink><txp:permlink /></txp:permlink></span> &middot;
<span class=“search_results_link”><txp:posted format=”%b %d, %Y” /></span>
<br />
</div>
</code>
<br />
Code for the actual page template:

<code>
<div id=“maincontent”>
<txp:if_search>
<txp:chh_if_data>
<txp:article />
<txp:older /><txp:newer />
<txp:else />
<p>Your search returned no results.</p><br />
<p>Please try again.</p>
</txp:chh_if_data>
</txp:if_search>
</div>
</code>
<br />
Thank you! :-)

<br />
Els wrote:

<txp:older> and <txp:newer> (on the page template) are working for me on my search results page. Did you put them after the article tag?

I think I actually got them to work. I don’t have enough articles currently to even warrant them (only have about 5), but before when I tried to use them I was getting some database error or something. I’m nto getting that error anymore so they much be okay…although I think I’m going to use the ob1googlenav plugin for this need of mine.

Offline

#7 2006-09-26 00:51:35

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

Re: two questions about search results page

Try:

<txp:older>Prev</txp:older> <txp:newer>Next</txp:newer>

As to the excerpt problem, I can’t see anything that’d cause it. Putting your site in production mode might reveal something (like a warning message, etc).

Offline

#8 2006-09-26 17:14:23

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: two questions about search results page

Thanks Mary. That’s what I was doing wrong. I thought that just putting <txp: older/> would output the text that I needed. I didn’t write it as <txp: older>Prev</txp:older>

As for the other problem I was having with the excerpt, I guess it’s working as it should. Maybe some small bug or something with it only showing up in the first result but it’s one that I can live with. For some reason if you type in “lorem” in the search, you’ll only get an excerpt with the first result in the list, but if you simply type “a” in the search, all results have an excerpt. So I don’t know. It’s good enough though. To the visitor, they probably wont even realize anything.

Offline

#9 2006-09-27 04:00:59

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: two questions about search results page

Regarding the excerpt problem: please test with the simplest possible template code, minus the chh_if_data part, and see if what happens.


Alex

Offline

#10 2006-09-27 17:36:09

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: two questions about search results page

Alex,

Tried what you suggested and it did the same thing. Do you think it might have something to do with all three test articles I’ve got currently have the exact same excert text therefore, if I do a search for “lorem” it just shows an result excerpt in the first one on the list because the other two have the same exact text?

Offline

Board footer

Powered by FluxBB