Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-07 01:36:52

boyandin
Member
Registered: 2005-09-16
Posts: 21

How to use the same page for article list, category list and search?

Greetings!

I have a start page with main content generated by:

<code>
<txp:article_custom form=“lastitem” limit=“1” />
<h3>Last 9 articles</h3>
<txp:article_custom form=“headline” limit=“10” offset=“1” />
</code>

The problems:

- when I use categories ‘pop-up’ selection, the same content is displayed. What can I use to display the selection by category in this case?

- the same about search results

In both cases above I won’t display the initial content (the last article and 10 recent in a list) along with selections (by category or search criteria).

Could you please suggest the best solution?

Thank you!

Konstantin

Last edited by boyandin (2006-03-07 01:38:34)


Om gate gate paragate parasamgate bodhi svaha

Offline

#2 2006-03-07 02:20:30

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

Re: How to use the same page for article list, category list and search?

Hi Konstantin,

First, you can use <txp:article /> instead of <txp:article_custom />.
Results will be exactly the same, but in my opinion, the correct tool is txp:article.
You can read more about this in
txp:article vs. txp:article_custom
Also, if need you need more info, you can read the entries for both tags in the TextBook Tag Listing .

Regarding to what you want to achieve, I’m not totally sure about what you want.
Maybe something like this?

<code><txp:if_category>
…content if a category is being displayed.
<txp:else />
…content if we are not in a category listing
</txp:if_category>
</code>

You can merge that snippet with some txp:if_article_list and I have no doubt that you will achieve what you want.

About the searchs results, there is also a txp:if_search conditional (container) tag.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2006-03-07 13:48:42

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: How to use the same page for article list, category list and search?

Actually you will require “nested” conditionals, which is a little tricky so I shall show you:-

<code>
<txp:if_category>
blah blah
<txp:else />
<txp:if_search>
blah blah
<txp:else />
blah blah
</txp:if_search>
</txp:if_category></code>
<br />

You can avoid the “if_search” tags and make life a bit simpler by sending your search results to their own section. Read zem’s article on how to do this. It’s a bit old but it still applies.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#4 2006-03-09 00:23:47

boyandin
Member
Registered: 2005-09-16
Posts: 21

Re: How to use the same page for article list, category list and search?

Thank you friends, I’ll experiment with these. I read once there are problems with nested conditionals, so your advice is very relevant.


Om gate gate paragate parasamgate bodhi svaha

Offline

Board footer

Powered by FluxBB