我想在ExpressionEngine模板中使用一些存储的cookie值,而不使用任何PHP.
我目前的模板代码
{exp:channel:entries channel="favorites" category="<?php echo $COOKIE['favorite']?>"}
{title}
{/exp:channel:entries}
Run Code Online (Sandbox Code Playgroud)
这很难看,并且在负载下表现不佳.有什么建议?也许是一个插件?
您必须使用Functions类中的set_cookie()方法在EE中设置cookie.
$this->EE->functions->set_cookie('your_cookie_name', 'some_value', 3600 * 24) // Set a cookie that expires in 1 day
$this->EE->input->cookie('your_cookie_name'); // returns 'some_value';
Run Code Online (Sandbox Code Playgroud)
来自Devot的EE附加组件:ee
http://devot-ee.com/add-ons/cookies