Forum OpenACS Q&A: Re: suppress errors in templates

Collapse
Posted by Torben Brosten on
Jeff,

When you reference a template in an include, you're using the file pathname reference.

Using your example, if subtemplates:item has a value of my-unique-template-for-this-one-user-this-afternoon then you could check for its existence by adding the openacs root dir to the filepath name:

\[file exists "\[acs_root_dir\]\$subtemplates:item\].tcl"
\[file exists "\[acs_root_dir\]\$subtemplates:item\].adp"

..the pathname might need some tweaking.. but there it is.

These could be scanned one at runtime, since you're defining the templates prior to startup.

FYI, depending on how you're doing this, you might be opening your system up to some security issues. You don't want to give users direct access to specifying template names.

cheers,

Torben