content::item::get (public)

 content::item::get -item_id item_id [ -revision revision ] \
    [ -array_name array_name ]

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

Get an item.

Switches:
-item_id (required)
-revision (optional, defaults to "live")
live, latest
-array_name (optional, defaults to "content_item")
name of array to upvar content into
Returns:
upvars array_name containing all attributes of the content type except content
returns 0 if item does not exists or 1 if query was successful
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28

Testcases:
content_folder, content_item
Source code:
    upvar $array_name local_array
    if {$revision ni {live latest}} {
        error "content::item::get revision was '${revision}'. It must be 'live' or 'latest'"
    }
    set content_type [content::item::get_content_type -item_id $item_id]
    if {$content_type eq ""} {
        # content_type query was unsuccessful, item does not exist
        return 0
    }
    if {"content_folder" eq $content_type} {
        return [db_0or1row get_item_folder "" -column_array local_array]
    }
    set table_name [acs_object_type::get_table_name -object_type $content_type]
    while {$table_name eq ""} {
        acs_object_type::get -object_type $content_type -array typeInfo
        ns_log notice "no table for $content_type registered, trying '$typeInfo(supertype)' instead"
        set content_type $typeInfo(supertype)
        set table_name [acs_object_type::get_table_name -object_type $content_type]
    }
    set table_name "${table_name}x"
    # get attributes of the content_item use the content_typex view
    return [db_0or1row get_item "" -column_array local_array]
Generic XQL file:
<fullquery name="content::item::get.get_item">
    <querytext>
      select cx.*,
      ci.live_revision,
      ci.latest_revision,
      ci.locale,
      ci.publish_status,
      ci.content_type,
      ci.storage_type
      from ${table_name} cx,
      cr_items ci
      where ci.${revision}_revision = cx.revision_id
      and ci.item_id = :item_id
    </querytext>
</fullquery>

<fullquery name="content::item::get.get_item_folder">
    <querytext>
      select cf.*,
      ci.name,
      ci.item_id,
      ci.live_revision,
      ci.latest_revision,
      ci.locale,
      ci.publish_status,
      ci.content_type,
      ci.storage_type
      from cr_folders cf,
      cr_items ci
      where ci.item_id = cf.folder_id
      and ci.item_id = :item_id
    </querytext>
</fullquery>
packages/acs-content-repository/tcl/content-item-procs.xql

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

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

[ hide source ] | [ make this the default ]
Show another procedure: