Forum OpenACS Development: Re: A Model for the Navigation Bar

Collapse
Posted by Jim Lynch on

So far, we've seen how to create two different interactions, one where, since we go "deeper" away from the index page, the navigation bar grows, and one where, since we're returning to the same page, the navigation bar stays the same length.

This last kind of interaction is where, since we're returning to a "shallower" page, one which is closer by one link to the index page, we will need to pull off one list item from context_fragment, so that the destination page will have a navigation bar one link shorter than the one on the current page. Here's how we would form the url:

set old_cntxt_frag \
    [lrange $context_fragment 0 end-1]

set back_url \
    [export_vars \
        -base the-destination \
        [list [list context_fragment $old_cntxt_frag]]]
and when the link is taken with this url, the navigation bar will be shortened by one link, as expected.

These are the three kinds of interactions: lengthen by one, stay the same and shorten by one. We've covered those three interactions here using links, and showing how to make the urls using export_vars. Another possibility for getting from one page to another, is through the use of forms. If there's interest, I'll cover some of these interactions using them.

If anyone found this useful, or are having problems, let me know.