Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-07-19 18:58:04
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
How to add a class to every other excerpt?
How the title implies, I have a float setup and need to add a certain class to every 3rd excerpt. How do I go this, please?
Thanks again.
Offline
Re: How to add a class to every other excerpt?
zem_nth is your friend.
Offline
#3 2007-07-19 19:48:52
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
Re: How to add a class to every other excerpt?
Ahhh…. excellent. Thank you!
Offline
#4 2007-07-19 20:39:40
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
Re: How to add a class to every other excerpt?
Actually, one thing. I need to do a step=1 of=3, but I need the first row of 3 to have a unique class from the others. It doesn’t seem this is possible with this… any advice?
Offline
Re: How to add a class to every other excerpt?
Use two txp:article tags and make use of the ‘limit’ and ‘offset’ attributes.
Offline
#6 2007-07-19 23:04:41
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
Re: How to add a class to every other excerpt?
ruud wrote:
Use two txp:article tags and make use of the ‘limit’ and ‘offset’ attributes.
There we go. Got it all to work. You gals/guys are great.
Offline
#7 2007-07-20 03:53:01
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
Re: How to add a class to every other excerpt?
But there is one final thing to work out.
I have the closing </div> tag happening on every step 3 of 3, but if there are only 1 or 2 articles, it won’t be added, causing a problem in the layout. I can’t seem to figure out how to fix this.
Offline
#8 2007-07-20 04:53:13
- jadehouse
- Member
- Registered: 2007-06-26
- Posts: 75
Re: How to add a class to every other excerpt?
Ok, I solved it (this is the first article with the limit to 1)
<txp:zem_nth step=1 of=3><div class=“rowSet rowSetFirst”></txp:zem_nth>
<div class=“set<txp:zem_nth step=3 of=3> setSide</txp:zem_nth>”>
<h2><txp:permlink><txp:title /></txp:permlink></h2>
<txp:excerpt />
</div>
<txp:zem_nth step=1,2,3 of=3><txp:if_last_article></div></txp:if_last_article></txp:zem_nth>
I didn’t think the if_last_article would work inside the loop (figured it’d be objective)… but that shows my lack of programming knowledge =/
Offline