You are not logged in.
This one is kind of tricky.
I am trying to build a 2-column list that will show all the articles in a given section.
I want both columns to be roughly the same height.
<txp:article_custom section="given" limit="TOTAL_ARTICLES_IN_SECTION(divided by)2" />
<txp:article_custom section="given" offset="TOTAL_ARTICLES_IN_SECTION(divided by)2" />
Is it possible? I’m praying for a PHP miracle
Last edited by Ace of Dubs (2006-11-15 03:17:32)
Offline
In related news..
What on earth is TXP:count?
Quite a few people have identified it as a global variable, but nobody knows what it does…
Offline
So you can try this
<txp:asy_wondertag><txp:article_custom section="given" limit="<txp:php>echo round(getCount('textpattern', 'status>4 and section="given"')/2);</txp:php>" /></txp:asy_wondertag>
You will need asy_wondertag. The @getCount($table, $criteria)@ function will return the number of articles that match the criteria you give it against the table you give it.
Offline
Where do you see txp:count?
On a side note I noticed that getcount (line 326) and safe_count (line 226) perform the same action in txplib_db.php. Is there a reason for both?
Offline
Thanks a bunch variaas,
I tried your code but article custom is returning articles from all sections for some weird reason..
As for txp:count, I got that from here
Offline
Interesting, so if it’s actually displaying the article, then something is happening with the article_custom function. If you changed tag to just the simple <txp:article_custom section="given" limit="20" /> does it show articles from only the “given” section?
Offline
so it looks like <txp:count /> actually calls the php function count(), so it doesn’t really do anything. I couldn’t find a place where $pretext['count'] every exists. Maybe it was deprecated.
Offline
Yup..just tried a basic article_custom like you posted and it works as expected. My problem might be due to limitation of the wondertag plugin. Sencer mentioned that it wasn’t guaranteed to work in all scenarios. I’ll post a crosslink in his thread and see what he thinks.
Thanks again for that code… I would not have known where to start!
Offline
It turns out my database needed some table repair. It works beautifully now
You my friend, are a genius!!!
:D
Offline