PHP を使用せずに、保存されている Cookie 値を ExpressionEngine テンプレートで使用したいと考えています。
現在のテンプレート コード
{exp:channel:entries channel="favorites" category="<?php echo $COOKIE['favorite']?>"}
{title}
{/exp:channel:entries}
これは見苦しく、負荷がかかるとうまく機能しません。助言がありますか?もしかしてアドオン?
PHP を使用せずに、保存されている Cookie 値を ExpressionEngine テンプレートで使用したいと考えています。
現在のテンプレート コード
{exp:channel:entries channel="favorites" category="<?php echo $COOKIE['favorite']?>"}
{title}
{/exp:channel:entries}
これは見苦しく、負荷がかかるとうまく機能しません。助言がありますか?もしかしてアドオン?
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';
Devot:ee の EE アドオン