Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-09 22:18:16

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Conditionally output something based on comment cookie

This thread describes a plugin, but says that the functionality is now included in the TXP core.

I would like to output a little snippet based on whether or not the “remember” cookie has been set, but I don’t see anything like that on Textbook.

Is that plugin’s functionality really available in the core now? Is there a conditional tag I can use?

Thanks in advance.

Offline

#2 2009-06-10 00:56:51

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Conditionally output something based on comment cookie

Setting variable named cookie:

<txp:variable name="cookie" value='<txp:php> echo (isset($_COOKIE["txp_remember"])) ? "set" : ""; </txp:php>' />

After that:

<txp:if_variable name="cookie" value="set">
	He knows us.
<txp:else />
	I like anon.
</txp:if_variable>

Offline

#3 2009-06-10 03:45:32

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: Conditionally output something based on comment cookie

Awesome!! Exactly what I needed and works like a charm. Thank you so much.

Offline

Board footer

Powered by FluxBB