template::resource_path (public)

 template::resource_path [ -verbose ] -type type -style style \
    [ -relative ] [ -subsite_id subsite_id ] [ -theme_dir theme_dir ]

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

Process the templating "style" and return the stub (path without extensions). When the style is not an absolute path, check if the resource can be obtained from the theme, if not fallback to the resources directory of acs-templating.

Switches:
-verbose (optional, boolean, defaults to "false")
-type (required)
type of resource (e.g. "forms" or "lists")
-style (required)
name of the resource within the type (e.g. "standard")
-relative (optional, boolean)
return optionally the path relative to the OpenACS root directory
-subsite_id (optional)
subsite_id to determine theming information
-theme_dir (optional)
theming directory (alternative to determination via subsite), higher priority
Returns:
path of the resource (without extension)
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 ad_dimensional ad_dimensional (public) template::resource_path template::resource_path ad_dimensional->template::resource_path packages/acs-templating/tcl/tag-init.tcl packages/acs-templating/ tcl/tag-init.tcl packages/acs-templating/tcl/tag-init.tcl->template::resource_path template::dat_page_filter template::dat_page_filter (private) template::dat_page_filter->template::resource_path template::form::template template::form::template (private) template::form::template->template::resource_path template::list::element::render template::list::element::render (public) template::list::element::render->template::resource_path ad_conn ad_conn (public) template::resource_path->ad_conn parameter::get parameter::get (public) template::resource_path->parameter::get

Testcases:
No testcase defined.
Source code:

    if {![regexp {^/(.*)} $style path]} {

        if { ![info exists theme_dir] } {
            if { ![info exists subsite_id] } {
                set subsite_id [ad_conn subsite_id]
            }
            set theme_dir [parameter::get -parameter ResourceDir -package_id $subsite_id]
        }

        if {$theme_dir ne ""} {
            if {![file isdir $::acs::rootdir/$theme_dir]} {
                ns_log warning "ResourceDir '$theme_dir' does not exist under '$::acs::rootdir'; ignore parameter setting of subsite $subsite_id"
                set theme_dir ""
            }
        }

        if {$theme_dir ne ""} {
            set path $theme_dir/$type/$style
            set lookup_path [expr {[file extension $path] eq "" ? "${path}.adp" : $path}]
            if {$verbose_p} {
                ns_log notice "themed_template: try themed template '$lookup_path'"
            }
            if {![file exists $::acs::rootdir/$lookup_path]} {
                unset path
            }
        }
        if {![info exists path]} {
            set path /packages/acs-templating/resources/$type/$style
        }
    }

    if {$relative_p} {
        return $path
    } else {
        return $::acs::rootdir/$path
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: