Forum OpenACS Q&A: Re: Dose already acs-lang work?

Collapse
Posted by Ola Hansson on
The "oacs_set_login_vars" procedure looks like something that was added just to the openacs.org instance and not to the general toolkit - I am not sure what it does. Try to comment it out and see what happens...

Anyway, I think I forgot to mention a few things in my earlier reply:

Please excuse me if I am pointing out the obvious.

If we take the default home page that you get after you have installed OpenACS as an example, you can change the <master> tag at the top of index.adp so that it reads <master src="homepage-new-index">. This file (and I forgot to mention it earlier) is an intermediate template which renders the boxes. This is how we do it here on openacs.org, except we have an etp instance serving the content of the home page (the main text between the boxes) instead of an index.tcl/adp pair. The concept is still the same, however.

When someone requests '/' on your server the index page (the main content) will wrap itself in the homepage-new-index template (think spiffy boxes) which can (and does) contain both HTML/ADP code as well as several different include calls that point to the desired widgets. The widgets provide content to the homepage-new-index template, but before they do at least some of the widgets (recent news and new postings for instance) wrap _themselves_ in a template that yields the box frame which should be consistent among all boxes. This box-template (in the widgets/ dir) returns the finalized boxes to homepage-new-index.

The homepage-new-index.adp file should just have a plain <master> tag at the top so it will wrap the general-master over itself, and a <slave> tag where you want the template that "called it" to appear.

The general-master is *our* default-master because we figured it would be smoother to switch to a new default-master than to start hacking on the existing and working one. And since it is possible to easily switch the master via a parameter in the site sitemap you could have a bunch of them lying prepared if you want to switch later on.

So, to sum it up:

- Pages that want the pretty little boxes might call a template similar to homepage-new-index.adp but with another set of includes, obviously.

- Most pages will probably only want the header and footer, so they will just call the default-master (general-master in our case).

It is rather nice to be able to use intermediate templates that will in turn call a general "default-master" so you can reuse the least common denominator - header and footer for example.

Also, look at the code in the cvs repository as example code only... It will probably not work on your site without pretty heavy modification. But if you want to quickly simulate the structure of openacs.org on your site you could try to remove the .tcl files in the template pairs and replace every occurence of @whatever@ with some static text and fill in the blanks later...

Hope this helps,