Forums / Developer / Conditional output

Conditional output

Author Message

Talk Apache

Saturday 17 July 2004 10:28:49 pm

I wish to display text on my article based on some condition like weather the user is logged in or not logged in. If the user is not logged in, i wish to show some text like "Please register to get access to links below:" but if the user is already registered user and logged in I don't wish to show this text. I can do it via template overrides. But then i have to write all text of my document in a template. Is that any way to do this if i can do this by entering some tags in an article?

Thanks

Talk Apache

Alex Jones

Tuesday 20 July 2004 8:42:32 am

Well, you can't just add a tag to the text of an article, but you could modify the article class (or any other class for that matter) to include a check box that would toggle the login requirement. You could then create the override template to detect the state of the check box. If the box is checked, the template would then check to see if the user is logged in. IF they are, the links would be shown, if not, your message would be shown.

Does this help?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>