Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-01-15 11:43:10
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Can't get the search to do what I want
Firstly this is the first search I’ve constructed and I’m having a few problems.
I’ve got this code in my page:
<form action=”/search” method=“get” name=“search” id=“search”>
<input name=“q” size=“18”> <input type=“submit” value=“Search” class=“button”/>
and then this in the forms:
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><search_result_url/></p>
When you type something into my search it brings up a range of results which are actual pages and individual articles and the search not very specific. Also it displays the article names.
I want it to display only full pages and the proper name of the page not the article name.
I’ve looked at few links such as justinfrench as well as a few others but can’t get the search to do what i want. What is the quickest and easiest solution for a newbie.
Last edited by gmorgan (2008-01-15 12:53:57)
Offline
#2 2008-01-15 16:35:36
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't get the search to do what I want
If you have articles that don’t exist as individual articles, but are only displayed as an article list (at least that is what I think you are referring to), you can change the search_results form so it doesn’t display the individual article URL but for instance the section page. I’m doing the same thing for a couple of my sections. So instead of <txp:permlink><txp:title /></txp:permlink>
you could do something like this:
<txp:if_article_section name="some-section">
<txp:section title="1" link="1" />
</txp:if_article_section>
Offline
#3 2008-01-18 10:48:13
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
Hi thanks for your reply, I’ve tried this but its giving me no results at all now.
Offline
#4 2008-01-18 10:57:07
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
Got it working now I chnaged my code from
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><search_result_url/></p>
to
<h3><txp:section title=“1” link=“1”/></txp:permlink></h3>
<p><search_result_url/></p>
and its now working, buts its not displaying everything
Last edited by gmorgan (2008-01-18 11:16:46)
Offline
#5 2008-01-18 14:34:29
- kevinpotts
- Member
- From: Ghost Coast
- Registered: 2004-12-07
- Posts: 370
Re: Can't get the search to do what I want
I’m not sure why you are using the <txp:section />
tag. Could you not just have something like this in the form “search_results”:
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:excerpt />
<p><search_result_url /></p>
Keep in mind you can use both search results-specific tags (<search_result_url />
) as well as normal article tags (<txp:title />
). Now, when you say it’s not displaying “everything”, keep in mind the <txp:article />
tag defaults to only 10 results. So you may want to add the limit attribute to your search results page. For instance, you might have something like this in your search page:
<txp:if_search_results>
<txp:article form="search_results" limit="999" />
</txp:if_search_results>
Hopefully I am not muddying the waters.
Kevin
(graphicpush)
Offline
#6 2008-01-22 10:17:57
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
Hi thanks for everyones help, I’m now using
<h3><txp:permlink><txp:section title=“1” limit=“999”/></txp:permlink></h3>
<txp:excerpt />
<p><search_result_url /></p>
It kinda works but still is only displaying 10 results, its displaying all the section titles as i want but there are a few slips like ‘article’.
The first bit of code you provided only gives article results and the second doesnt work at all. Thanks for all your help.
Offline
#7 2008-01-22 16:17:30
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Can't get the search to do what I want
The section tag doesn’t accept a limit attribute, since that makes no sense. You apply that to the article tag.
Offline
#8 2008-01-31 15:06:05
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
something I forgot to say was that my images are not being displayed on some of the search result pages, its just got the ‘alt’ text. I think its becuase its displaying the full section and id and not just the section.
Last edited by gmorgan (2008-01-31 15:16:56)
Offline
#9 2008-01-31 17:11:52
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't get the search to do what I want
Where are your images, inside the articles or on the page? And which tags or code are you using to display them? If you are not using the TXP tags, it’s probably just a matter of adding a /
before the image path.
Offline
#10 2008-02-05 11:51:20
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
yup I’ve left some / off the beginnings of my image paths, thanks ever so much. This forum rocks!
Offline
#11 2008-02-07 12:06:33
- gmorgan
- Member
- Registered: 2007-11-26
- Posts: 42
Re: Can't get the search to do what I want
One last query, when you search for something, once you click on a page which is displayed from the search result none of the links will work on that page.
Offline
#12 2008-02-07 17:26:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't get the search to do what I want
We need more information :)
Do you mean that you click one of the search results, which takes you to the individual search result/article page, and on that page the links don’t work?
Can you give examples, what do the URLs that don’t exist look like?
And can you post the exact content of your search_results form?
Offline