Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-09-19 16:04:44
- Xell
- New Member
- From: Canada
- Registered: 2007-09-19
- Posts: 5
Article Specific Styling based on Catagory
Hi, hoping someone can answer this for me.
My site is setup like this, I have one main page that contains several different articles on various topics. I would like to color code this article titles based on category (News-Red, Tutorials-Green, ect.)
I know I have to alter the article form to put something like this…
<txp:if_article_category name=“News-Updates” number=“1”>
<div id=“artNewsDiv”><txp:article form=“default” /></div>
<txp:else />
…
but I’m not sure what the exact code should be. So far everything I’ve done hasn’t worked. My articles still show up without a id wrapper around them.
Any help would be great.
Offline
Re: Article Specific Styling based on Catagory
Page template:
<txp:article form="default" />
Default article form :
<txp:if_article_category name=“News-Updates” number=“1”>
<div id=“artNewsDiv”>
</txp:if_article_category>
<txp:if_article_category name=“another-category” number=“1”>
<div id=“anothercategorydiv”>
</txp:if_article_category>
<h2><txp:title></h2>
<txp:body />
...
</div> <!-- this div closes any "category div" open above by conditionals tags -->
I hope that helps.
Offline
Re: Article Specific Styling based on Catagory
Other option, without using conditionals.
In your article form:
<div class="<txp:category1 />">
<h3><txp:title /></h3>
...etc...
</div>
And then, you create different CSS rules based on your categories names.
Offline
#4 2007-09-19 19:24:04
- Xell
- New Member
- From: Canada
- Registered: 2007-09-19
- Posts: 5
Re: Article Specific Styling based on Catagory
maniqui wrote:
Other option, without using conditionals.
In your article form:
<div class="<txp:category1 />">
<h3><txp:title /></h3>
...etc...
</div>
And then, you create different CSS rules based on your categories names.
I really like this idea. Thanks alot to the both of you.
Offline
Re: Article Specific Styling based on Catagory
Xell wrote:
I really like this idea. Thanks alot to the both of you.
We are the same!
Offline
Re: Article Specific Styling based on Catagory
Well that’s just your opinion maniqui. I wonder what the other one thinks about it. ;)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline