Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2022-12-29 09:21:48
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
How to add auto numbering in article list
I want to list top 3 articles and want to add automatic numbering with each title:
<txp:article_custom category="top" limit="5">
<span class="number">{here come auto number}</span> : <txp:title />
</txp:article_custom>
Output Need:
1 : article title here
2 : article title here
3 : article title here
Last edited by raminrahimi (2022-12-29 09:54:57)
Offline
Re: How to add auto numbering in article list
Hi
Why not use CSS for that :
<ol>
<txp:article_custom category="top" limit="5">
<li><txp:title /></li>
</txp:article_custom>
</ol>
Offline
#3 2022-12-29 09:56:14
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: How to add auto numbering in article list
No, I want to use the numbering exactly in my template. The numbering is designed in the span <span class="number">...
Offline
Re: How to add auto numbering in article list
You can either increment a variable
<txp:article_custom category="top" limit="5">
<span class="number"><txp:variable name="count" add output /></span> : <txp:title />
</txp:article_custom>
or use the internal <txp:yield item="count" />
txp counter
<txp:article_custom category="top" limit="5">
<span class="number"><txp:yield item="count" /></span> : <txp:title />
</txp:article_custom>
Offline
#5 2022-12-31 05:20:37
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: How to add auto numbering in article list
etc wrote #334426:
You can either increment a variable
<txp:article_custom category="top" limit="5">...
Thanks, this works fine for me :-)
Offline