Difference between revisions of "Carma get extended"

From TMM Wiki
Jump to navigationJump to search
m
 
Line 48: Line 48:
 
| None.
 
| None.
 
| type=gal
 
| type=gal
 +
|-
 +
| raw_only
 +
| Set to 1 to not parse extended data as XML.  Needed with HTML data in extended data
 +
| 1 or 0
 +
| 0
 +
| raw_only=1
 
|-
 
|-
 
| var
 
| var

Revision as of 20:03, 23 February 2009

CARMA
  Template Functions
CARMA Template Functions
carma_actor_photo_name
carma_comments_display
carma_comments_form
carma_count
carma_favorite
carma_gal_custom
carma_get_extended
carma_list
carma_list_favorites
carma_list_gals
carma_list_third_party_content
carma_list_videos
carma_login_log
carma_most_viewed
carma_newest
carma_news
carma_poll
carma_retrieve_sections
carma_search
carma_actors_search
carma_show_gal
carma_show_video
carma_top_actors
carma_top_rated
carma_upcoming
print_page_numbers
Template Function Aliases
carma_comment_display
carma_display_comment
carma_display_comments
carma_extended
carma_extended_data
carma_get_extended_data
carma_list_all
Common Parameters
assign
assign_prefix
count
data_only
display_on_assign
start
tpl

Applies to CARMA Version 1.0.12 or greater

Aliases: carma_get_extended_data, carma_extended, carma_extended_data

  • Purpose: get extended data for a content set, picture, or video clip
  • Usage: {carma_extended galid=1}
  • Required parameters: galid
  • Optional parameters: file, var, type (required for videos)
  • Default Templates Used: none
  • Variables created: $carma_extended

Parameters

(Required parameters in bold)

Parameter Description Possible Values Default Value Example
galid Display this gallery's extended data Any valid gallery number None. You must provide a valid gallery number galid="123"
actorid Get extended data from this actor The numeric I.D. of the actor to get extended data from None. actorid="123"
file The file to get data from numeric id or file name None. file="123"
type Type of content to get (note: type must be set if galid is a video.) Any valid content type None. type=gal
raw_only Set to 1 to not parse extended data as XML. Needed with HTML data in extended data 1 or 0 0 raw_only=1
var Smarty variable to assign the data to Any valid Smarty variable name carma_extended var="my_var"

You must set either galid or actorid.

Description

Retrieve Extended Data from a content set, a single picture, a single clip, or an actor. The extended data stored is parsed for XML and both the raw data and the parsed XML can be accessed using the following variables created:

  • $carma_extended.raw - raw data
  • $carma_extended.parsed - XML parsed data

$carma_extended.parsed is the root of the XML data. Each root-tag is an item of that array. XML allows you to have multiple tags with the same name for the same parent, so each tag name points to an array. The parent arrays items are each child tag name in the order they are added. To access attributes of each item, use _attrib and to access cdata of each item, use _cdata. Each item can of course also have child-tags.

For example, the following XML tree,

<data>
<title>The Title</title>
<items>
<item name="test">Foo</item>
<item name="another test">Bar</item>
</items>
</data>

creates the following array structure,

$carma_extended.parsed.DATA[0].TITLE[0]._cdata - "The Title"
$carma_extended.parsed.DATA[0].ITEMS[0].ITEM[1]._attrib.name - "another test"
$carma_extended.parsed.DATA[0].ITEMS[0].ITEM[0]._cdata - "Foo"