Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-08 20:39:26

mscwd
Member
Registered: 2005-06-28
Posts: 13

Can I.... Display x number of articles on homepage from x categories

Is it possible to show, say 3 articles from each one of your site categories on the homepage? So I may have 3 articles from category 1 at the top of the homepage, 3 articles from category 2 in the middle of the homepage and so on…

Also if it is possible, would I be able to style each set of articles differently using css?

Thanks,

-mscwd

Last edited by mscwd (2006-06-08 20:40:52)

Offline

#2 2006-06-08 20:47:36

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Can I.... Display x number of articles on homepage from x categories

Sure. Make use of article_custom.

Offline

#3 2006-06-08 21:05:35

mscwd
Member
Registered: 2005-06-28
Posts: 13

Re: Can I.... Display x number of articles on homepage from x categories

Great that looks perfect, just one other question though.

Although you can display x number of articles from any category. Would it be possible to say display articles from category 1 300px wide and further down the homepage display articles from category 2 600px wide. Its just an example but what I need to know is with the article custom tag do you have control over the appearance of articles it displays?

Offline

#4 2006-06-08 21:37:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Can I.... Display x number of articles on homepage from x categories

Sure you can do that, but it’s a CSS matter. Use something like this:
<code>
<div id=“category1”>
<txp:article_custom category=“category1” limit=“3” />
</div>
<div id=“category2”>
<txp:article_custom category=“category2” limit=“3” />
</div>
<div id=“category3”>
<txp:article_custom category=“category3” limit=“3” />
</div>
</code>
Then style the divs in the CSS.

Or do it in the article form:
<code>
<txp:if_article_category name=“category1”><div class=“category1”></txp:if_article_category>
<txp:if_article_category name=“category2”><div class=“category2”></txp:if_article_category>
<txp:if_article_category name=“category3”><div class=“category3”></txp:if_article_category>
<txp:title />
<txp:body />
</div>
</code>

Offline

Board footer

Powered by FluxBB