Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-06-22 20:49:21

Szorstki
Member
From: Poland
Registered: 2012-05-27
Posts: 20

Articles listform with <ul> and form without <ul>

Hi there :)
I’m trying to display articles with two forms:

  • unordered list, only with title, excerpt and link “read more”
  • individual article in <article> tag

My list form:

<h3><txp:permlink><txp:title /></txp:permlink></h3>
 	<txp:excerpt />
  	<txp:permlink>» Więcej</txp:permlink>

My single form:

<article class="articles">
  <h1><txp:permlink><txp:title /></txp:permlink></h1>
  <txp:body />
</article>

Call this forms in page template:

<txp:article class="articles" form="single" listform="list" />

How do I make TXP to display the list in <ul> and items in <li> tags? I’ve tried to do it in a few ways, but I only get more confused :D When adding txp:article tag to form “list”, there are like for every article generated list of articles… so there are many duplicates. Is there any way, to generate <ul> and <li> automaticaly? Or I should call it like

<txp:article class"articles" wraptag="ul" break"li" ... />
even ehen single article is displayed?

Offline

#2 2012-06-22 21:55:46

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 927

Re: Articles listform with <ul> and form without <ul>

In this case, the duo form/listform don’t helps. You can do it with:

<txp:if_article_list>
	<ul>
		<txp:article limit="??" break="li" form="list" />
	</ul>
<txp:else />
	<txp:article limit="1" form="single" />
</txp:if_article_list>

Offline

#3 2012-06-22 21:59:22

Gocom
Developer
Registered: 2006-07-14
Posts: 4,476
Website

Re: Articles listform with <ul> and form without <ul>

Please see if_article_list and if_individual_article tags, and bookmark the Tag Reference if you haven’t.

When you need two different views for individual article pages and the section page’s lists, you can use the two mentioned conditional tags. E.g.

<txp:if_individual_article>
	<txp:article>
		<article class="articles">
			<h1><txp:permlink><txp:title /></txp:permlink></h1>
			<txp:body />
		</article>
	</txp:article>
<txp:else />
	<txp:article wraptag="ul" break="li" class="articles">
		<h3><txp:permlink><txp:title /></txp:permlink></h3>
		<txp:excerpt />
		<txp:permlink>» Więcej</txp:permlink>
	</txp:article>
</txp:if_individual_article>

Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

Board footer

Powered by FluxBB