Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Search Page
Hi,
I just created a page at http://www.simplecandy.com/search
The search form at the top of ALL pages directs to this page and uses it to display the list of of items found!
This is the code for the page, how do I get it to show my results?
*edit: please feel free to add extra ideas to the search page too, so better ways of structuring the code and seperating content. Is it possible to display the content and seperate it in sections, such as:
About
item 1
item 2
Portfolio
item 1
item 1.1
item 1.2
item 2
<txp:output_form form="html_head" />
<txp:output_form form="header" />
<div id="container">
<div id="body">
<h3>Search</h3>
<txp:if_search>
<p><txp:text item="search_results" />: <txp:page_url type="q" /></p>
</txp:if_search>
</div><!--//body-->
<txp:output_form form="footer" />
Last edited by driz (2008-09-15 16:26:46)
~ Cameron
Offline
#2 2008-09-15 16:33:54
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Search Page
You’ll need a <txp:article />
tag to display the search results. Have a look at if_different (FAQ) for creating the list that you want. You need to customize form ‘search_results’.
Offline
Re: Search Page
Els wrote:
You’ll need a
<txp:article />
tag to display the search results. Have a look at if_different (FAQ) for creating the list that you want. You need to customize form ‘search_results’.
:S I don’t get that tag, could you post an example in context to my question, thanks a lot. x
~ Cameron
Offline
Re: Search Page
driz wrote
:S I don’t get that tag, could you post an example in context to my question, thanks a lot. x
if_different
is simple.
When the form is looped through whatever is in the if_different
tag will show if it’s different from the article before.
Offline
Re: Search Page
So I would need to use that tag for each section I want to show? What if i wanted to auto show ALL, so if I added a new section I wouldn’t have to create a new txp_diff tag. x
~ Cameron
Offline
Re: Search Page
You would place <txp:if_different><txp:section /></txp:if_different>
in the “search_results” form.
And then to group the results you’ll need to use the <txp:article />
tag Els mentioned above.
Offline
Re: Search Page
Okies so this is what I have in my search_results form, I want to add a <hr /> after the different sections lists. Where do I put the hr. x
<txp:if_different><h2><txp:section /></h2></txp:if_different>
<h3 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h3>
<p class="published"><txp:posted /></p>
<p class="entry-summary"><txp:search_result_excerpt /></p>
<p class="small"><txp:permlink><txp:permlink /></txp:permlink></p>
Last edited by driz (2008-09-15 17:18:23)
~ Cameron
Offline
Re: Search Page
driz wrote:
I want to add a <hr /> after the different sections lists. Where do I put the hr. x
Do you mean after each section or after the entire list?
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: Search Page
Replace your first line with this:
<txp:if_different>
<txp:if_first_article>
<txp:else />
<hr />
</txp:if_first_article>
<h2><txp:section /></h2></txp:if_different>
That basically puts an <hr />
before the <h2>
except on the first section.
I think that’ll get what you’re after.
Edit: I’ve never nested those tags – give it a shot.
If not, try wrapping that in with the asy_wondertag plugin.
Last edited by renobird (2008-09-15 17:41:04)
Offline
Re: Search Page
It would be nice if txp:if_different
could have some attribute to test against to.
Like: <txp:if_different what='<txp:section />'>
.
AFAIK, in 4.0.7, some tags will be tag context sensitive, so if something like what I suggested above could exist, then the attribute will be tested on the context of the article form being rendered (and not in the context of the current section).
Well, as it is now, because <txp:section />
works differently if it’s inside an article form (it outputs the section to which the article belongs) or if it’s dropped on a page template (used on an article-list, so it will output the current section being viewed).
Offline
Re: Search Page
4.0.7 sounds a whole lot more advanced, I think their gonna have to revise Textpattern Solutions :D
~ Cameron
Offline
Re: Search Page
[Currently ignoring driz for lack of respect]
Prime example. Several people took time out to help you with a question.
Is there a “Thanks – that worked” or “I appreciate the help, but that’s not what I need” in there anywhere?
No. You just make some inane statement.
Please. Either take some time to learn how you should conduct yourself on a forum, or take your lack of respect elsewhere.
There is good work being done here, and all this nonsense is stopping folks from being productive.
Offline