Forum OpenACS Development: Response to Breadcrumb trail service?

Collapse
Posted by Michael Feldstein on

Application packages already do create breadcrumb trails using the site map. It's called ad_context_bar. The best thing is to set a variable called context_bar and include it in the master ADP template so the context bar appears in the same place on each page. Just calling ad_context_bar with one argument (the page's title) will usually do something reasonable; alternatively you can customize things a bit further by giving multiple arguments or just write the context bar by hand.

This is awesome. Can somebody try it and see how it well it works? Are there any tweaks required to make it work more reliably? Do we need to include info about how to set this up in some kind of a style guide?

Changing the root of the context bar: I suppose that ad_context_bar could be extended to have some configurability. I'd be wary of doing a database hit to get the configuration data though, because it happens on every single page.

Is there any way to do this in a way that is less of a drag on performance? Some way to cache the info or something? It's not like this parameter is going to change very often.

Adding a context bar to static pages - well just rename .html to .adp, make sure is in there, and make a .tcl file which does nothing but set the context_bar variable.

That sounds like more work than a non-programming admin could do, unless I'm not understanding something correctly. What I'd like to see is a way that the admin could have the context bar set properly simply by uploading the pages into the proper folder or something equally easy. If we want this to be used for large sites, then no hand programming or even hand setting of per-page admin parameters should be required.

Utility to view the site map: there are probably some utility procs to do some of this already.

Ultimately, what I have in mind here is the ability for the system to dynamically generate all navigation structures, including menu bars, context bars, and site maps, from such procs. The first step in that direction is to be able to extract the hierarchy tree from whatever it is that generates the context bar and make that tree available to other applications. Would this require a service contract?