Difference between revisions of "Taxonomy 1 0-getCSTaxObj"

From ADF Docs
Jump to: navigation, search
(Description)
 
m (Reverted edits by Ecaxabu (Talk) to last revision by Rwest)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Description ==
+
__NOTOC__
 +
Attention: Do not change any text in the description, signature, and paramter sections.
  
Description
+
Return to [[Taxonomy_1_0]]
 +
 
 +
== Description ==
 +
Returns the taxonomy object for a given taxonomy name
 +
 
 +
== Signature ==
 +
public any <strong>getCSTaxObj</strong> ( string taxName )
 +
 
 +
== Parameters ==
 +
 
 +
<table id="lib-params">
 +
<tr class="header">
 +
<td>Required</td>
 +
<td>Name</td>
 +
<td>Type</td>
 +
<td>Description</td>
 +
</tr>
 +
 +
 +
<tr>
 +
 +
<td class="required">required</td>
 +
 +
<td>taxName</td>
 +
<td>string</td>
 +
<td></td>
 +
</tr>
 +
 +
</table>
 +
 
 +
== Examples ==
 +
 
 +
Using the getCSTaxObj function is simple and straight forward. Making a call to this method will return a component which contains all of the Taxonomy API calls available in the CommonSpot Taxonomy.
 +
 
 +
=== CE Data calls return Taxonomy Term ID ===
 +
If you have Taxonomy fields inside your Custom Element and you make calls to get data for that custom Element using CEData, the Taxonomy fields will return term ID's.  You can convert those term ID's using code like this:
 +
<source lang="cfm">
 +
<cfscript>
 +
    // custom element data
 +
    data = application.ADF.ceData.getCEData("My Element");
 +
    // returns taxonomy object
 +
    taxObj = application.ADF.taxonomy.getCSTaxObj("My Taxonomy");
 +
</cfscript>
 +
 
 +
<cfloop from="1" to="#arrayLen(data)#" index="itm">
 +
    <!---// renders the term name instead of the term id --->
 +
    <cfoutput>#taxObj.getTermName(data[itm].values.myTaxField)#</cfoutput>
 +
</cfloop>
 +
</source>

Latest revision as of 17:40, 24 November 2010

Attention: Do not change any text in the description, signature, and paramter sections.

Return to Taxonomy_1_0

Description

Returns the taxonomy object for a given taxonomy name

Signature

public any getCSTaxObj ( string taxName )

Parameters

Required Name Type Description
required taxName string

Examples

Using the getCSTaxObj function is simple and straight forward. Making a call to this method will return a component which contains all of the Taxonomy API calls available in the CommonSpot Taxonomy.

CE Data calls return Taxonomy Term ID

If you have Taxonomy fields inside your Custom Element and you make calls to get data for that custom Element using CEData, the Taxonomy fields will return term ID's. You can convert those term ID's using code like this:

 <cfscript>
     // custom element data
     data = application.ADF.ceData.getCEData("My Element");
     // returns taxonomy object
     taxObj = application.ADF.taxonomy.getCSTaxObj("My Taxonomy");
 </cfscript>

 <cfloop from="1" to="#arrayLen(data)#" index="itm">
    <!---// renders the term name instead of the term id --->
    <cfoutput>#taxObj.getTermName(data[itm].values.myTaxField)#</cfoutput>
 </cfloop>