Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

5 Unbelievable Tricks to Help You COPE

489 views

Published on

An overview of his favorite techniques for applying COPE (Create Once, Publish Everywhere) for both content and formats. Includes Velocity and Web Services sample code.

Published in: Software
  • Be the first to comment

  • Be the first to like this

5 Unbelievable Tricks to Help You COPE

  1. 1. 5 Unbelievable Tricks to Help You COPE Eric L. Epps, Sauk Valley Community College @ericepps #CUC15 #COPEtricks Which Hannon Hill
  2. 2. 1. “It’s not about the web page” (Cascade as a data warehouse)
  3. 3. 2. “Ultimate set of tools” (Take advantage of Cascade tools)
  4. 4. • Data Definition Smart Fields
  5. 5. • Data Definition Smart Fields • Content Types/Content Type Publishing
  6. 6. • Data Definition Smart Fields • Content Types/Content Type Publishing • XSL Page Transforms
  7. 7. • Data Definition Smart Fields • Content Types/Content Type Publishing • XSL Page Transforms • Web Services
  8. 8. • Data Definition Smart Fields • Content Types/Content Type Publishing • XSL Page Transforms • Web Services • Velocity Script Tools (Velocity Includes, Locator Tool, Query API)
  9. 9. 3. “Give me all the XML” (APIs to XML using Web Services)
  10. 10. • $restURL = 'https://api.somesite.com?apikey={{secret}}'; $returnJSON = file_get_contents($restURL); createXMLBlock($cascade, $auth,'/parent/folder', 'theAssetName', $siteName, $returnJSON,'json'); • foreach($values as $value) { $restURL = ‘https://api.somesite.com?apikey={{secret}}&value=' . $value; $returnXML = file_get_contents($restURL); createXMLBlock($cascade, $auth, '/parent/folder', $value, $siteName, $returnXML,'xml'); }
  11. 11. • $restURL = 'https://api.data.gov/ed/collegescorecard/v1/schools.json? id=148672,147703&_fields=school.name,school.city,school.state,id&api_key={{ secret}}'; $scJSON = file_get_contents($restURL); createXMLBlock($cascade,$auth, '/-blocks/CareerOneStop', 'scorecard', $siteName, $scJSON,'json'); • foreach($socCodes as $value) { $socCode = str_replace(‘-‘,'',$value); $restURL = 'http://www.careerinfonet.org/webservices/occwages_webservice/occwagesservi ce.asmx/GetWagesByZip?userID='.$apiKey.'&soccode='.$socCode.'&zip='.$zipCod e; $wagesXML = file_get_contents($restURL); createXMLBlock($cascade,$auth, '/-blocks/CareerOneStop/Wage', $value, $siteName, $wagesXML,’xml'); } • http://bit.ly/cuc15-restapi (GitHub)
  12. 12. 4. “A Brick Within a Block Within a ShortCode” (Bricks and ShortCodes)
  13. 13. #set ( $sib = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block) ) #set ( $bricks = $_XPathTool.selectNodes($sib, "system-page/system-data- structure/brick") ) #macro ( useBricks $contentString ) #set ( $string = $contentString ) #foreach ( $item in $bricks ) #set ( $var = "[" + $_EscapeTool.xml($item.getChild("name").value) + "]" ) #set ( $val = $_EscapeTool.xml($item.getChild("value").value) ) #set ( $string = $string.replaceAll($var, $val) ) #end ${string} #end #set ( $page = $_XPathTool.selectSingleNode($sib, "calling-page/system-page") ) #set ( $content = $_SerializerTool.serialize($page.getChild("page-xhtml"), true) ) #useBricks($content) Bricks
  14. 14. • [getBlock type="xhtml" path="/absolute/path/to/block" site=“siteName"] • [getBlock type="xhtml" path="/absolute/path/to/block" site="siteName" replace="textreplacement1 textreplacement2" textreplacement1="value to display #1" textreplacement2="value to display #2”] (will replace the string "[|[textreplacement1]|]" in the block with "value to display #1" and "[|[textreplacement2]|]" with "value to display #2”) • http://bit.ly/cuc15-shortcode (GitHub)
  15. 15. 5. “Better together” (Content Layering)
  16. 16. Faculty/Staff Websites
  17. 17. Program Pages
  18. 18. Thank you! eric.epps@svcc.edu github.com/ericepps

×