This example shows how to pull content from an external dotCMS site using the ContentAPI and displays the results paginated.
#set($page=1) #set($limit=5) #if($request.getParameter("page")) #set($page=$math.toInteger($request.getParameter("page"))) #end #set($nextPage=$math.add($page,1)) #set($prevPage=$math.sub($page,1)) #set($offset=$math.mul($page,$limit)) #set($offset=$math.sub($offset,1)) #set($myjson = $json.fetch("http://dotcms.com/api/content/render/false/query/+structureName:PressRelease/orderby/modDate%20desc/limit/$limit/offset/$offset")) #foreach($content in $myjson.contentlets) <p><a href="http://www.dotcms.com/about/press-release/$content.urlTitle">$content.title</a> <br/>$content.teaser </p> #end #if($prevPage>0) <a href="?page=$prevPage">Previous</a> | #end <a href="?page=$nextPage">Next</a>