Difference between revisions of "CSData 1 0-getPageMetadata"

From ADF Docs
Jump to: navigation, search
(Usage:)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 +
Attention: Do not change any text in the description, signature, and paramter sections.
 +
 +
Return to [[CSData_1_0]]
 +
 
== Description ==  
 
== Description ==  
Return the standard and custom metadata for a page.
+
Given a Page ID, getPageMetadata will return a structure containing the standard and custom metadata for a page.
  
 
== Signature ==  
 
== Signature ==  
Line 27: Line 32:
 
<tr>
 
<tr>
 
 
<td>&nbsp;</td>
+
<td class="required">optional</td>
 
 
 
<td>categoryID</td>
 
<td>categoryID</td>
Line 36: Line 41:
 
<tr>
 
<tr>
 
 
<td>&nbsp;</td>
+
<td class="required">optional</td>
 
 
 
<td>subsiteID</td>
 
<td>subsiteID</td>
Line 44: Line 49:
 
 
 
<tr>
 
<tr>
<td>optional</td>
 
 
 
 
<td class="required">optional</td>
 
<td class="required">optional</td>
Line 54: Line 58:
 
 
 
</table>
 
</table>
 +
=== Usage: ===
 +
Example 1: Get the approval status for the current page.  Uses the standard page metadata:
 +
<source lang="cfm">
 +
<cfscript>
 +
        pageMeta =  application.ADF.CSData.getpageMetadata(request.page.id);
 +
    if ( StructKeyExists(pageMeta.standard, "approvalStatus") AND
 +
              LEN(pageMeta.standard.approvalStatus)){
 +
       
 +
    pageApprovalStatus = pageMeta.standard["approvalStatus"];
 +
       
 +
        }
 +
</cfscript>
 +
</source>
 +
 +
Example 2: Get the blogID from the custom Metadata form bound to the current page:
 +
<source lang="cfm">
 +
<cfscript>
 +
    pageMeta =  application.ADF.CSData.getpageMetadata(request.page.id);
 +
if ( StructKeyExists(pageMeta.custom, "Blogs2") AND
 +
              (StructKeyExists(pageMeta.custom.Blogs2, "blogID")) and
 +
              (LEN(pageMeta.custom.Blogs2.blogID))){
 +
  blogID = pageMeta.custom.Blogs2.blogID;
 +
   
 +
    }
 +
</cfscript>
 +
</source>

Latest revision as of 21:32, 26 March 2012

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

Return to CSData_1_0

Description

Given a Page ID, getPageMetadata will return a structure containing the standard and custom metadata for a page.

Signature

public Struct getPageMetadata ( numeric pageID, numeric categoryID, numeric subsiteID, string inheritedTemplateList )

Parameters

Required Name Type Description
required pageID numeric
optional categoryID numeric
optional subsiteID numeric
optional inheritedTemplateList string [Default: ]

Usage:

Example 1: Get the approval status for the current page. Uses the standard page metadata:

<cfscript>
        pageMeta =  application.ADF.CSData.getpageMetadata(request.page.id);
    	 if ( StructKeyExists(pageMeta.standard, "approvalStatus") AND
              LEN(pageMeta.standard.approvalStatus)){
        
     	 pageApprovalStatus = pageMeta.standard["approvalStatus"];
        
        	}
</cfscript>

Example 2: Get the blogID from the custom Metadata form bound to the current page:

<cfscript>
     pageMeta =  application.ADF.CSData.getpageMetadata(request.page.id);
 	 if ( StructKeyExists(pageMeta.custom, "Blogs2") AND 
               (StructKeyExists(pageMeta.custom.Blogs2, "blogID")) and 
               (LEN(pageMeta.custom.Blogs2.blogID))){
  	 blogID = pageMeta.custom.Blogs2.blogID;
     
     	}
</cfscript>