template::tag (public)

 template::tag name arglist body

Defined in packages/acs-templating/tcl/0-acs-templating-procs.tcl

Generic wrapper for registered tag handlers.

Parameters:
name (required)
arglist (required)
body (required)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-templating/tcl/tag-init.tcl packages/acs-templating/ tcl/tag-init.tcl template::tag template::tag packages/acs-templating/tcl/tag-init.tcl->template::tag template_tag template_tag (public, deprecated) template_tag->template::tag _ _ (public) template::tag->_

Testcases:
No testcase defined.
Source code:

  # LARS:
  # We only ns_adp_registerscript the tag if it hasn't already been registered
  # (if the proc doesn't exist).
  # This makes debugging templating tags so much easier, because you don't have
  # to restart the server each time.
  set exists_p [expr {[namespace which template_tag_$name] ne {}}]

  switch [llength $arglist] {

    1 {

      # empty tag
      eval "proc template_tag_$name { params } {

    template::adp_tag_init $name

    $body

        return \"\"
      }"

      if { !$exists_p } {
        ns_adp_registerscript $name template_tag_$name
      }
    }

    2 {

      # balanced tag so push on/pop off tag name and parameters on a stack
      eval "proc template_tag_$name { chunk params } {

    template::adp_tag_init $name

    lappend ::template::tag_stack \[list $name \$params\]

    $body

    template::util::lpop ::template::tag_stack

        return \"\"
      }"

      if { !$exists_p } {
        ns_adp_registerscript $name /$name template_tag_$name
      }
    }

    default { error [_ acs-templating.Tag_handler_invalid_number_of_args] }
  }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: