Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
How can I make an if-statement for a var with global scope? Is there an easier way to do this than to use a temporary variable?
Code: Select all
<cms:set tplname="<cms:show k_template_name scope='global' />" />
<cms:if tplname="archive.org">...
While searching for a variable, Couch begins with the scope of the immediate statement and, if not found there, continues upwards through all parent statements till it finally reaches the global level.

So if, at the point in your code where you are using the <cms:if> statement, there are other variables named 'k_template_name' (in different scopes, of course), then you'll have to use a temporary variable to fetch the right 'k_template_name'.

If, however, that is not the case then you may directly use it as per usual, e.g. as given below, and the global value will be fetched correctly
Code: Select all
<cms:if k_template_name="archive.org">...

Hope this answers your query.
Thank you, this answers my question.
3 posts Page 1 of 1
cron