Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-15 16:22:50

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#3 2008-09-15 16:52:10

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#4 2008-09-15 16:55:21

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#5 2008-09-15 16:57:49

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#6 2008-09-15 17:06:49

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#7 2008-09-15 17:18:09

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

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

#8 2008-09-15 17:38:18

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

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?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#9 2008-09-15 17:38:44

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#10 2008-09-15 17:50:54

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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).


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2008-09-15 17:57:07

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Search Page

4.0.7 sounds a whole lot more advanced, I think their gonna have to revise Textpattern Solutions :D


~ Cameron

Offline

#12 2008-09-15 18:08:49

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

Board footer

Powered by FluxBB