Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-01-19 07:22:23

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Article count

When we have a long list of article and we decide of put in a column, into 2/3 columns (table or div is the same), we must use some hack because into global variable $thisarticle is set only what is the first and the last article.
I think is useful for each article set his position in list.

For example if I call: <txp:article category="xx" limit="20" listform="listing" form="default" /> i obtain 20 article of XX catgory.
So when i call listing form i know if the actual article that form parse is the first, the second, ecc.. and is more easy put it in a column.
It’s necessary two parameters: into $thisarticle set value $thisarticle[num] (for example) and a new conditionally function:
<txp:if_num_article is="X"></txp:if_num_article>

Last edited by MarcoK (2012-01-19 07:22:42)

Offline

#2 2012-01-19 08:03:06

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Article count

I’m sure as a coder you solved this yourself, but I imagine you could use the plugin mdn_count (or rah_function with txp’s internal function safe_count) to get the number of articles and put it in a txp:variable, then adi_calc (or a quick bit of php) to divide by three and then use the results to make your txp:article statements using the offset and limit functions.

In newer browsers – and probably in future – you don’t need this at all as you can use css3 multi-column layouts for this.

Last edited by jakob (2012-01-19 08:03:19)


TXP Builders – finely-crafted code, design and txp

Online

#3 2012-01-19 08:37:57

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Article count

It’s true, but as you say I must use different plugin for obtain a single thing that if it were integrated it would be more easy.
Not only for columnize but also for set a different parameters or different text or any thing you wont in different article.

Thanks for the link at css3 multi column!!!!!

Last edited by MarcoK (2012-01-19 08:40:16)

Offline

Board footer

Powered by FluxBB