template::get_attribute (public)

 template::get_attribute tag params name [ default ]

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

Retrieves a named attribute value from the parameter set passed to a tag handler. If a default is not specified, assumes the attribute is required and throws an error.

Parameters:
tag (required)
The name of the tag.
params (required)
The ns_set passed to the tag handler.
name (required)
The name of the attribute.
default (optional, defaults to "ERROR")
A default value to return if the attribute is not specified in the template. A default value of "ERROR" will cause the proc to throw an error if the attribute wasn't supplied.
Returns:
The value of the attribute.

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-templating/tcl/tag-init.tcl packages/acs-templating/ tcl/tag-init.tcl template::get_attribute template::get_attribute packages/acs-templating/tcl/tag-init.tcl->template::get_attribute publish::process_tag publish::process_tag (private) publish::process_tag->template::get_attribute

Testcases:
No testcase defined.
Source code:
    set value [ns_set iget $params $name]

    if {$value eq ""} {
        if { $default eq "ERROR" } {
            error "Missing [string toupper $name] property in [string toupper $tag] tag"
        } else {
            set value $default
        }
    }

    return $value
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: