publish::merge_with_template (private)

 publish::merge_with_template item_id [ args... ]

Defined in packages/acs-content-repository/tcl/publish-procs.tcl

Parameters:
item_id - The item id
Options:
-revision_id
{default The live revision} The revision which is to be used when rendering the item
-html
Extra HTML parameters to be passed to the ADP parser, in format {name value name value ...}
Returns:
The rendered HTML, or the empty string on failure
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 publish::handle::text publish::handle::text (public) publish::merge_with_template publish::merge_with_template publish::handle::text->publish::merge_with_template publish::handle_binary_file publish::handle_binary_file (public) publish::handle_binary_file->publish::merge_with_template content::get_template_root content::get_template_root (public) publish::merge_with_template->content::get_template_root content::item::get_live_revision content::item::get_live_revision (public) publish::merge_with_template->content::item::get_live_revision content::item::get_template content::item::get_template (public) publish::merge_with_template->content::item::get_template content::item::get_virtual_path content::item::get_virtual_path (public) publish::merge_with_template->content::item::get_virtual_path publish::pop_id publish::pop_id (private) publish::merge_with_template->publish::pop_id

Testcases:
No testcase defined.
Source code:
  #set ::content::item_id $item_id
  set ::content::item_url [::content::item::get_virtual_path -item_id $item_id]

  template::util::get_opts $args

  # Either auto-get the live revision or use the parameter
  if { [info exists opts(revision_id)] } {
    set revision_id $opts(revision_id)
  } else {
    set revision_id [::content::item::get_live_revision -item_id $item_id]
  }

  # Get the template
  set ::content::template_url [::content::item::get_template -item_id $item_id -use_context public]

  if {$::content::template_url eq {}} {
    ns_log Warning "publish::merge_with_template: no template for item $item_id"
    return ""
  }

  ns_log debug "publish::merge_with_template: template for item $item_id is $::content::template_url"

  # Get the full path to the template
  set root_path [content::get_template_root]
  set file_stub [ns_normalizepath "$root_path/$::content::template_url"]

  # Set the passed-in variables
  if { [info exists opts(html)] } {
    set adp_args $opts(html)
  } else {
    set adp_args ""
  }

  # Parse the template and return the result
  publish::push_id $item_id $revision_id
  ns_log debug "publish::merge_with_template: parsing $file_stub"
  set html [template::adp_parse $file_stub $adp_args]
  publish::pop_id

  return $html
Generic XQL file:
packages/acs-content-repository/tcl/publish-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/publish-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/publish-procs-oracle.xql

[ hide source ]
Show another procedure: