Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Cookies - PHP & TXP:Variables
Hi,
I’ve been looking at chs_cookies as a way of handling cookies in a <txp> style tag.
Unfortunately it looks neglected and doesn’t work with <txp:else /> and sets only session cookies unless you fiddle with the plugin code.
So I look to PHP … using something like this for a user to set their own limit for articles shown on the frontpage.
<txp:php>
if(isset($_COOKIE['limit']))
$limit = $_COOKIE['limit'];
else
$limit = 20;
<?php>
I know txp tags all equate to a equivalent php function … I’d like to set a <txp:variable /> to = $limit
Can someone give a code example of setting a <txp:variable/> in PHP
Thanks
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: Cookies - PHP & TXP:Variables
Like so:
<txp:php>
if(isset($_COOKIE['limit'])) $limit = $_COOKIE['limit']; else $limit = 20;
variable(array('name' => 'limit', 'value' => $limit));
</txp:php>
Offline
Re: Cookies - PHP & TXP:Variables
Great!!
Thanks Robert
Merry Xmas – Happy Holidays
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Pages: 1