Forum OpenACS Q&A: Include Templates

Collapse
Posted by Peter Alberer on
Is there any way to find out (in the context of a tcl file) if this tcl/adp (component) is included via another adp file ?

The Problem is i want to have a component serving the table of contents of a book. I am using the following files:

  • one-toc.tcl (gets db data and chooses template)
  • one-toc-full.adp (outputs toc and full headers)
  • one-toc-inline.adp (outputs just the toc)

    if the component is included via another adp file there should be no header, footer and so on. But if the file is invoked directly the header should be displayed.

    one option would be to pass parameters like display_mode = ( full | inline ) but the calling adp file could have this parameter set as well.

    This causes problems: the tag does not work (does not pass the $mode) if the including adp file has a variable $mode.

    does anybody have a good solution for something like that ?

    TIA

  • Collapse
    Posted by David Walker on
    You can probably use [info level [info level]] to determine where you are.
    Collapse
    Posted by Lee Denison on

    alternatively:

    global template::parse_level
    set include_level [llength $parse_level]

    should work well.

    Collapse
    Posted by Peter Alberer on
    thanks a lot ! it works now :)