Forum OpenACS Development: Re: Just noticed something strange happening with acs-templating if tags....

Unfortunately, after looking into more details, the problem is not the IF-tag or the variable scoping, but the way how OpenACS handles @-variables. The best, i can offer is the following approach, falling back to tcl + aolserver/NaviServer primitiva:
  <property name="foo">
  if {[info exists admin_link]} {
      ns_puts "<a href='$admin_link' accesskey='a' title='Administer this package ...'>Admin</a> ·"
  <link rel="stylesheet" type="text/css" href="/resources/xowiki/xowiki.css" media="all" >
This means, instead of using the IF-tag and @-variables, one can use tcl-code and tcl-vars. If this looks feasible for you, i'll post the necessary modifications... This approach requires only a slightly more complex change like the one posted before

-gustaf neumann


Thank you for the follow-up, and for the suggestion of falling back to the lower level solution.

It occurs to me that whilst you clearly cannot nest <if> tags inside a <property> tag, you can of course put <property> tags inside an <if> tag! :-)

I have therefore re-ordered my template to conditionally populate a property for each of the wikicmds, and to pass these properties separately up to the master template.  The master template will display these if they are not nil and will wrap them in their containing <div>.  This seems to work just fine.

The advantage is that this works without any modification to acs-templating.  The disadvantage is that it requires xowiki specific modification to my plain-master.adp, however this is in a custom theme package anyway, so not really a problem.

Whilst doing this I discovered something else I didn't know, which is that property names cannot contain a hyphen! Is that widely known?

If I pass up and test for <property name="wikicmds_index"> everything works as expected.  However, if I use <property name ="wikicmds-index"> I get an error message inserted into the page which reads:

IF tag nil test uses string not variable for "@wikicmds-index@"

I wonder if that is a feature or a bug?

Regards & many thanks,

Ok, i read through the lines, that you are happy with your solution. I'll keep the mentioned modification on my development machine, but do not investigate further.

Concerning the property names: I am not aware of any document that defines the valid syntax of the names, but i am not surprised that there are limitations. however, it is not worth to try to lift these.