Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hey there, Couch-people :)

I am currently trying to somehow store the current year in a variable that i can re-use for a <cms:if> condition, to display an "active" attribute in an anchor tag.

I tried creating a global value using the cms:php tag, but i can't seem to use it in the if condition.. Is there any suggested best practise?

This is what i tried:

Code: Select all
desc='enter year'
type='text' />

  global $curyear;
   $curyear = echo date('Y');

<cms:if year = curyear >

I am not a PHP expert, so i am sure i am missing something here - a less clumsy approach would also be greatly appreciated! :)

Thanks in advance!

Kind regards

You can set and get variables with couch code. Couch also has a date tag.
Code: Select all
<cms:set curyear = "<cms:date format='Y' />" 'global' />
<cms:if year == curyear>

Code: Select all
<cms:if year == "<cms:date format='Y' />" > class="active"</cms:if>
2 posts Page 1 of 1

Who is online

In total there are 4 users online :: 1 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: Google [Bot] and 3 guests