categories.template showing article names

categories.template showing article names

Postby noidpro on Tue Sep 08, 2009 12:05 pm

Hi everyone,
I would like to have a categories.template page to link to that not only shows the number of articles per category, but also a nice list with the name of each article.
I guess I need to put a foreach inside a foreach, but I have no other idea on how to do that. Could you help me with the code?

this is what i'm using at the moment, just copied and pasted from another template...
Code: Select all
{foreach from=$articlecategories item=articleCategory}
<a href="{$url->categoryLink($articleCategory)}">{$articleCategory->getName()}</a> [{$articleCategory->getNumArticles()}]<br/>

thanks a lot for lifetype, even I can use it!
Posts: 1
Joined: Tue Sep 08, 2009 11:55 am
LifeType Version: 1.2

Re: categories.template showing article names

Postby jondaley on Wed Sep 09, 2009 11:18 am

You'll need a plugin to be able to grab all of the articles for all time - the default templates only have the last 10 articles available to them. You might be able to do some crazy hack thing with setting your "show X most recent articles" to 1000 or something, but even if that works, it'll probably do bad things for performance. (and there is also a max recent articles in the administration settings, in addition to the blog specific setting in the control center).

See this plugin I wrote a while ago, but never checked in: ... tcategory/
Lifetype Expert
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Return to Templates