publish::render_subitem (public)

 publish::render_subitem main_item_id relation_type relation_tag index \
    is_embed extra_args [ is_merge ]

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

Parameters:
main_item_id - The id of the parent item
relation_type - Either child or relation. Determines which tables are searched for subitems.
relation_tag - The relation tag to look for
index - The relative index of the subitem. The subitem with lowest order_n has index 1, the second lowest order_n has index 2, and so on.
is_embed - If "t", the child item may be embedded directly in the HTML. Otherwise, it may be dynamically included. The proc does not process this parameter directly, but passes it to handle_item
extra_args - Any additional HTML arguments to be used when rendering the item, in form {name value name value ...}
is_merge (defaults to "t") - {default t} If "t", merge_with_template may be used to render the subitem. Otherwise, merge_with_template should not be used, in order to prevent infinite recursion.
Returns:
The rendered HTML for the child item
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 db_list db_list (public) publish::get_html_body publish::get_html_body (public) template::util::is_nil template::util::is_nil (public) publish::render_subitem publish::render_subitem publish::render_subitem->db_list publish::render_subitem->publish::get_html_body publish::render_subitem->template::util::is_nil

Testcases:
No testcase defined.
Source code:
  # Get the child item

  if {$relation_type eq "child"} {
      set subitems [db_list rs_get_subitems ""]
  } else {
      set subitems [db_list cs_get_subitems_related ""]
  }

  set sub_item_id [lindex $subitems $index-1]

  if { [template::util::is_nil sub_item_id] } {
    ns_log notice "publish::render_subitem: No such subitem"
    return ""
  }

  # Call the appropriate handler function
  set code [list handle_item $sub_item_id -html $extra_args]

  if {$is_embed == "t"} {
    lappend code -embed
  }

  return [get_html_body [{*}$code]]
Generic XQL file:
<fullquery name="publish::render_subitem.rs_get_subitems">
    <querytext>

      select 
        child_id
      from 
        cr_child_rels r, cr_items i
      where 
        r.parent_id = :main_item_id
      and 
        r.relation_tag = :relation_tag
      and
        i.item_id = r.child_id
      order by 
        order_n

      </querytext>
</fullquery>

<fullquery name="publish::render_subitem.cs_get_subitems_related">
    <querytext>

      select 
        related_object_id
      from 
        cr_item_rels r, cr_items i
      where 
        r.item_id = :main_item_id
      and 
        r.relation_tag = :relation_tag
      and
        i.item_id = r.related_object_id 
      order by 
        r.order_n

      </querytext>
</fullquery>
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 ] | [ make this the default ]
Show another procedure: