Forum OpenACS Q&A: Finding Variable Source

Collapse
Posted by Don Curt on
I am new to OpenACS and need a little help.

With the layered pages and variables that can cross pages, I can not understand how to find the source of a variable so I can change it.  In other words, where was the var set?

For example:

<propertyname="header_stuff">@header_stuff;noquote@</property>

How can I find the original "set" of @header_stuff@

Also, in the following code, where can I find any documentation on how to deal with HTMLArea?

global acs_blank_master__htmlareas
if { [info exists acs_blank_master__htmlareas] } {
    foreach htmlarea_id $acs_blank_master__htmlareas {
        append header_stuff "<script type=\"text/javascript\">var editor_var_${htmlarea_id} = new HTMLArea(\"${htmlarea_id}\");</script>"
        lappend onload "acs_initHtmlArea(editor_var_${htmlarea_id}, '${htmlarea_id}');"
    }
}

Thank you for any help.

Collapse
Posted by Ryan Gallimore on
Hi Don,

Those variables are set in "slave" pages using the property adp tag.

See https://openacs.org/doc/acs-templating/guide/master.html for more information.

Essentially, when you call your page foo.tcl/adp and it declares a property called header_stuff, it passes that value up the template stack to the master.

This allows you to set variables in the master at the page level, without changing the master template scripts.

To modify the behaviour of htmlAreas, see the acs-templating package parameters. If the solution is not there, let us know what you are looking to change.

Regards,
Ryan

Collapse
Posted by Don Curt on
Thank you Ryan for the quick response.

So if I understand, the scope of a variable (unless Global or Namespace)is only within the page "stack".

So if I want to find the original set of a var it has to be in the hierarchy of pages?

How do I know the var e.g. @header_stuff@ is not a var set somewhere else as a Global?

Thanks.

Don

Collapse
Posted by Dave Bauer on
Don,

The header_stuff property is set in the page serving the request, that is for each request you need to find the page that responds for that url and follow the path up to the master template.

What version of OpenACS are you using?

Collapse
Posted by Ryan Gallimore on
Typically, you do not have to look through the hierarchy of pages. If you are requesting /foo just override the master template value with a property tag in foo.tcl/adp.

The global value would only be used in your adp if it was the last value set, just like any other variable.

Here is another good reference:

https://openacs.org/doc/templates.html

Regards,
Ryan

Collapse
Posted by Lynn Clark on
Your info has helped me also. Thanks a lot!
Collapse
Posted by Brian Fenton on
Dear Don

I believe many people no longer use HTMLArea and instead use Xinha, so you may want to take a look at that too.

best wishes
Brian