eZ Community » Forums » Developer » set cookie
expandshrink

set cookie

set cookie

Thursday 04 June 2015 5:14:36 am - 1 reply

Hi,

I have to set a cookie with a name of a div in a last accessd url.So I have put this code into the template.It seems cookie is not setting.Is there a way to access the last accessed page with a cookie and view the same page later.

 

{setcookie( 'cook', 'metro');}     {def $gg = ezhttp( 'cook', 'cookie' )}

 

plz can you give me some help??

Monday 08 June 2015 5:31:48 am

Hello upeksha,

I'm not certain but this seems to be a requirement (re: setcookie in template) of a poor design.

Because templates are cached this could introduce complications and potential problems.

I know of no 'way' to 'access the last access page with a cookie and view the same page later'.

In short why do you think you require this use of a cookie, what specific requirement is driving it?

I really think you should look for another solution.

In general if you insist upon setting a cookie with a template then a custom template operator would be required or alternately you could use the SimpleOperator solution which is simple to enable direct access to the 'setcookie' php function with a template.

https://github.com/Open-Wide/OWSimpleOperator

I hope this helps!

Cheers,
Heath

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from