Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-05-02 20:35:07
- boss
- New Member
- From: Budapest
- Registered: 2006-05-02
- Posts: 4
How do I show the excerpt to a category and the full text to another.
Hi,
I have one section, and two categories.
The section name is: news, the categories are cat1,cat2.
What I want to do:
when I list the articels of the 2 categories in one list (by listing the section), I want textpattern show only the excerpts,
and when I list only the articles of the one example “cat1” I want to show the full text.
Any Idea?
Balazs
Offline
#2 2006-05-02 20:40:48
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I show the excerpt to a category and the full text to another.
<code>
<txp:if_section name=“news”>
<txp:article listform=“excerptform” />
</txp:if_section></code>
<code>
<txp:if_category>
<txp:article listform=“fullarticleform” />
</txp:if_category>
</code>
Something like this?
Offline
Re: How do I show the excerpt to a category and the full text to another.
hi boss,
try with something like in your article form:
<code><txp:if_category name=“cat1”>
<txp:body />
<txp:else />
<txp:excerpt />
</txp:if_category></code>
Or something like this in your page template
<code><txp:if_category name=“cat1”>
<txp:article form=“fulltext” />
<txp:else />
<txp:article form=“excerpted” />
</txp:if_category></code>
Of course, you will have to create two article forms: “fulltext” and “excerpted” and include there all the article tags that you want to display for each listing…
Or you can also do a combination of both method…
Or you will probably discover a new one…
Because in TXP there is always more than one way to achieve the same goal…
For more info about those txp tags, search them here:
Offline
Re: How do I show the excerpt to a category and the full text to another.
It’s not fair!
Els, you always type faster (and less) than me!
Offline
#5 2006-05-02 21:59:12
- boss
- New Member
- From: Budapest
- Registered: 2006-05-02
- Posts: 4
Re: How do I show the excerpt to a category and the full text to another.
Thanks the quick answer.
Now it works, but I don’t understand the mechanism.
I understand the conditional tags, and the logic, what I don’t understand is:
when I list the two categories in one list, why textpattern doesn’t list the excerpts for the “cat1” articels, and the body text for the other category.
I thought that textpattern parse these lines for each article, and therefore when the “cat1” category comes, list the excerpt, and for the else it lists the body text.
Thanks again.
Offline
#6 2006-05-02 22:12:48
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I show the excerpt to a category and the full text to another.
Ah, in that case you’d better change your article form:
<code>
<txp:if_article_category name=“cat1”>
here the excerpt code
</txp:if_article_category>
<txp:if_article_category name=“cat2”>
here the full article code
</txp:if_article_category>
</code>
The <txp:if_category />
conditional is not applied to the article category, but to the category page that is requested (meaning it’s looking for the category that’s in the url of the page), so if you are on a section page, and no specific category is requested, the conditional will not be true.
Last edited by els (2006-05-02 22:14:05)
Offline
#7 2006-05-02 22:22:16
- boss
- New Member
- From: Budapest
- Registered: 2006-05-02
- Posts: 4
Re: How do I show the excerpt to a category and the full text to another.
Ok,
now I understand.
Thank you Els,
Offline