Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-02-03 17:43:20
- jpeacock
- New Member
- Registered: 2008-08-26
- Posts: 7
php within article_custom for offset?
Hi all,
Is there any way to use php to output the offset for article_custom?
The “Older” tag towards the bottom picks up the correct variable, but i’m not sure if php within tags is stripping the variable. It works if I use a static number for the offset, but not a php variable. This is what I have but it doesn’t seem to do anything.
<txp:article_custom form="dailydose" category="Daily-Dose"
<txp:php>
$o=$_GET['o'];
$o+=10;
echo "offset='$o'";
</txp:php>
limit="10" />
<txp:php>
$o = $_GET['o'];
$o += 10;
echo "<a href='?o=".$o."'>Older</a>";
</txp:php>
Last edited by jpeacock (2009-02-03 17:52:15)
Offline
Re: php within article_custom for offset?
You can’t throw <txp:php>
in the middle of an article_custom. You need to use it’s function:
$offset = gps('o') + 10;
echo article_custom(array(
'form' => 'dailydose',
'category' => 'Daily-Dose',
'limit' => 10,
));
Offline
#3 2009-02-03 18:46:47
- jpeacock
- New Member
- Registered: 2008-08-26
- Posts: 7
Re: php within article_custom for offset?
Awesome, thanks. Just what I was looking for.
Offline
Re: php within article_custom for offset?
In Textpattern 4.0.7+ you could also take advantage of attribute parsing:
<txp:article_custom form="dailydose" category="Daily-Dose"
offset='<txp:php>echo gps('o') + 10;</txp:php>' limit="10" />
Last edited by wet (2009-02-04 05:01:59)
Offline
Pages: 1