Difference between revisions of "CCAPI Updating Elements"
(→Chaining Updates with Page Creates) |
|||
Line 46: | Line 46: | ||
== Chaining Updates with Page Creates == | == Chaining Updates with Page Creates == | ||
If you would like to chain a page creation with a page content update, add the "pageID"/"subsiteID" combo to your data before passing to the populateCustomElement method. | If you would like to chain a page creation with a page content update, add the "pageID"/"subsiteID" combo to your data before passing to the populateCustomElement method. | ||
+ | |||
+ | * dataPageID = the Custom Element Instance Record | ||
+ | * pageID = the pages ID which contains a Custom Element | ||
Note: You would be more likely to chain a populateCustom Element with a createPage if the page you were creating contained a Local Custom Element. | Note: You would be more likely to chain a populateCustom Element with a createPage if the page you were creating contained a Local Custom Element. | ||
− | |||
− | |||
− | |||
[[Category:CCAPI]] | [[Category:CCAPI]] |
Revision as of 22:47, 20 December 2009
Overview
The CCAPI Element object allows you to add or edit content for textblocks and custom elements. Your site must have a proper CCAPI Config file established in the site where you would like to use the CCAPI.
Example Usage
<cfscript> // custom element sample tmp = structNew(); tmp.field1 = "test"; tmp.field2 = "test 2"; // get the content object from the factory csContentObj = server.ADF.getBean("CSContent_1_0"); // call populate content (sorry I wish it was more difficult then that) results = csContentObj.populateContent("elementName", tmp); </cfscipt>
<cfscript> // textblock sample tmp = structNew(); tmp.textblock = "test"; tmp.caption = "test 2"; // get the content object from the factory csContentObj = server.ADF.getBean("CSContent_1_0"); // call populate content (sorry I wish it was more difficult then that) results = csContentObj.populateContent("elementName", tmp); </cfscipt>
<cfscript> // custom element sample with update tmp = structNew(); tmp.field1 = "test"; tmp.field2 = "test 2"; tmp.dataPageID = 29333; // get the content object from the factory csContentObj = server.ADF.getBean("CSContent_1_0"); // call populate content (sorry I wish it was more difficult then that) results = csContentObj.populateContent("elementName", tmp); </cfscipt>
Based on the "name" of the element passed in, the component will find the configuration from the CCAPI Config file and load the proper pageID/elementID combo, then populate content.
Updating Content
By default, if you are working with a textblock, content will always be updated. If you would like to update a Custom Element record, be sure to add "dataPageID" into your data struct (see example above). You will receive the "dataPageID" in your renderhandler. If you use CEData, it will be the "pageID" field for the record you are using.
Chaining Updates with Page Creates
If you would like to chain a page creation with a page content update, add the "pageID"/"subsiteID" combo to your data before passing to the populateCustomElement method.
- dataPageID = the Custom Element Instance Record
- pageID = the pages ID which contains a Custom Element
Note: You would be more likely to chain a populateCustom Element with a createPage if the page you were creating contained a Local Custom Element.