Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-11-14 21:35:26

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

create a template page for sections to show list or article

i want to create page to my sections to show list or article, example:
if i click to section (index.php?s=news) that should be show all the article titles of news section
if i click to each article from that section (index.php?id=22), so that has to show the exact article
can any one plz help me
thank you

Offline

#2 2013-11-15 02:54:33

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

Re: create a template page for sections to show list or article

Hi Ramin.

Check these tags: <txp:if_article_list> and its counterpart: <txp:if_individual_article>

A quick example:

<txp:if_individual_article>
  We are in individual article context. Let's print some article tags: <txp:title />, <txp:body />
<txp:else />
  We are in article list context.
  Let's print some articles:
 <txp:article>
   <txp:title />, <txp:body />
 </txp:article>
</txp:if_individual_article>

Now, the equivalent but using if_article_list:

<txp:if_article_list>
  We are in article list context.
  Let's print some articles:
 <txp:article>
   <txp:title />, <txp:body />
 </txp:article>
<txp:else />
  We are in individual article context. Let's print some article tags: <txp:title />, <txp:body />
</txp:if_article_list>

Edit: corrected text and link to wiki

Last edited by maniqui (2013-11-15 20:42:10)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2013-11-15 15:00:34

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: create a template page for sections to show list or article

thank you Maniqui, that’s perfect !

Offline

#4 2013-11-15 15:27:14

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: create a template page for sections to show list or article

maniqui, can you please correct the following line:

maniqui wrote:

Check these tags: <txp:if_article_section> and its counterpart: <txp:if_individual_article>

It should be <txp:if_article_list>.

Offline

#5 2013-11-15 15:53:21

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: create a template page for sections to show list or article

hi dear i’m using obq_pagination, that’s very good plugin but here the pagination not works, i mean no pagination appear ! :

<txp:if_individual_article> <txp:article /> <txp:else /> <h1><txp:section title=“1” /></h1> <txp:article form=“article_listing” limit=“2” /> <div class=“paginator “><txp:ob1_pagination /></div>
</txp:if_individual_article>

Last edited by raminrahimi (2013-11-15 15:54:09)

Offline

#6 2013-11-15 20:42:49

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

Re: create a template page for sections to show list or article

GugUser wrote:

maniqui, can you please correct the following line:

Done! Thanks! It was a copy-paste hiccup!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB