Forum OpenACS Q&A: acs-templating include path

Collapse
Posted by Jeff Rogers on

Where exactly does a <include src="..."> tag look for the subtemplate to include?

The docs say that if src is absolute (begins with a /) it locates the subtemplate relative to the server root, otherwise it is relative to the including template. But the theme ResourceDir appears to be searched as well, and skimming through the source it appears that acs-templating/resources is searched as a fallback as well.

Are there other hidden features here too? Like, can a theme package inherit from another theme and only update the templates that are changed?

Bonus: what about the <widget> tag?

Collapse
Posted by Gustaf Neumann on
Yes, the documentation is outdated. The parameter ResourceDir was added in OpenACS 5.9.0, in OpenACS 5.9.1 the theme manager [1,2] as added. Styling is currently best described in [3].

A theme can be defined per subsite (and be reused on several subsites). The theme can overload all templates that it whishes to refine. See e.g. the files overloaded my the openacs-bootstrap3-theme

find packages/openacs-bootstrap3-theme/ -type f|fgrep -v CVS

What about the widget tag?
Not sure, who introduced the "widget" tag at which time, probably one of the elders. It was used on various places in the openacs site. If i remember correctly, in OpenACS 5.9, it was added to the general code to reduce local differences. The "widget" tag is like the "include" tag, but it its searched additionally in a different directory. Examples for the openacs site are the recent announcements, recent postings, recent news, recent bugs, ... hosting, companies, etc.
So, widgets are essentially site-specific includes kept at a special place to avoid inferences with upstream changes. Its name probably comes from [4].

The place, where the "widgets" are kept (under the theme) is not perfect, probably this would be better placed under acs-subsite (would be usable for every subsite and every theme). The "widget" predates the theme-specific overloading of "includes".

[1] https://openacs.org/xowiki/openacs-todo
[2] https://openacs.org/Announce-OpenACS-5.9.1
[3] https://openacs.org/xowiki/oacs-theming
[4] https://openacs.org/doc/acs-templating/guide/composite