Forum OpenACS Q&A: Context bar inclusion in static pages

Just wanted to check that my conclusions are correct in relation to using the context bar in static pages to maintain continuity .

- I have a privacy page and a terms page which need to be available at the www root.
- I want the look and feel to be the same as the dynamic pages so I reference my standard .css file and have created a privacy.tcl which calls ad_page_contract and a privacy.adp that contains the text and layout - the master template does the header and the context bar.

When I display the www/sitename/privacy page, the context bar shows 'Your Workspace : Main' - which I believe is correct because the page is being served from the site root. However I would like it to show 'Your Workspace : Main : Privacy Statement'
I can think of two ways of doing this :
  1. Create a site node off the site root called 'privacy', create a new package called Privacy, create the requisite folders in the acs installation under packages - (i.e. in /packages/privacy), put my privacy.tcl and privacy.adp in there and finally mount the new package as 'Privacy Statement' on the new site node 'privacy'.
    Am I correct in thinking that this will allow the request processor to provide node info for the page to ad_context_bar and thus the correct output for the context bar?

  2. As the above is a complicated process for just a single static page, jerry rig it instead by hand coding a context bar into a static page under the www root and use the 'static pages' module to manage it!
There are probably dozens of other options that I have not thought of so I would greatly value opinions on the best way to do it.
Regards
Richard
Collapse
Posted by Tilmann Singer on
The most easiest option for you would be to include a

<property name="context">"Privacy Statement"</property>

just below the <master> tag - the other elements of the context bar should then be constructed automatically.

Collapse
Posted by Richard Hamilton on
Thank you very much.

R.
Collapse
Posted by Matthew Geddert on
i had a smiliar issue, something you may run into when you get more static pages. I wanted the files /web/openacs-4/www/programs/masters.html, to not only have a title with main page, but also list programs as a subsection. like this:
link.workspace : link.main site : link.programs : masters
To do this you can change /web/openacs-4/packages/static-pages/www/templates/static.tcl to this (note i have only made it possible to have one level of subdirectory because that is all i need - it would be easy to expand and make this a 3 or 4 subdirectory aware procedure):
ad_page_contract {

    create static page context
}

set url [ad_conn extra_url]
set url "StArTeR$url"
regsub -all {StArTeR([^\t]*)/([^\t]*)} $url {\1} bit1
regsub -all "/" $bit1 "" bit1
regsub -all {StArTeR([^\t]*)/} $url {} bit2

if {[string compare $bit2 ""]} {
    set context [list [list "/$bit1" "$bit1"] "$bit2"]
} else {
    set context [list "$bit1"]
}

set context $context

ad_return_template
and then packages/static-pages/www/templates/static.adp just needs to have the line:

<property name="context">@context@</property>