Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Get number of posts and do a little bit of calculation with it
This should be easier in TXP 4.0.7, due to the fact that attribute values can be parsed there. You’d just need a tag (or PHP code) that can generate the offset and limit values.
Oi, didn’t see wet’s solution. I do think you’d have to change that intval line to:
$quarter = ceil($posts / 4);
and change the limit line to:
'limit' => $quarter,
Last edited by ruud (2008-05-09 10:31:09)
Offline
Re: Get number of posts and do a little bit of calculation with it
Better, yes. I’m off-by-one, as always ;-)
Offline
#15 2008-05-09 15:33:30
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get number of posts and do a little bit of calculation with it
In order to replicate:
the first part queries the db, calculates, produces no visible output and has to be placed … well, anywhere before the second part, which then is used as a replacement for one of the four article_custom instances, and gets fed with the results of the calculations of part 1, right?
And the principle of
echo article_custom (
array( etc.
could be applied to any other appropriate txp-tag by replacing article_custom
with the tag’s name, I suppose.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get number of posts and do a little bit of calculation with it
Replaying an evergreen. But not for very much longer.
Last edited by wet (2008-05-09 20:38:28)
Offline
#17 2008-05-09 20:45:12
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get number of posts and do a little bit of calculation with it
wet schrieb:
But no tfor very much longer.
404. But I think you’re appealing to 4.0.7 and the rewritten parser.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get number of posts and do a little bit of calculation with it
Just executing svnsync
to our new permhome.
Offline
#19 2008-05-09 20:55:53
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get number of posts and do a little bit of calculation with it
From the linked evergreen:
Tag handler functions are named like their counterpart tags (stripping the
txp:
prefix).
This covers the last part of my question. But was I right with my other presumptions?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get number of posts and do a little bit of calculation with it
yes.
Offline
#21 2008-05-09 21:06:57
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get number of posts and do a little bit of calculation with it
Thanks. Want some Kölsch?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get number of posts and do a little bit of calculation with it
Thanks. Had a few Most just now.
Offline