Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created April 12, 2011 00:35
Show Gist options
  • Save mhulse/914683 to your computer and use it in GitHub Desktop.
Save mhulse/914683 to your computer and use it in GitHub Desktop.
Previous/Next story in section: 2011 update for DTI's Content Publisher (Lightning) CMS 7.6.x!
<dti:file:include base="assets" file="/includes/csp/story.prevnext.inc.csp?areas=Top Story,Top Stories,Other Stories,Bulleted Stories,Updates" />
#[ new areas set areas = $get(%request.Data("areas", 1)) ]#
<csp:if condition='$length(areas)'>
<csp:if condition=(($isobject(gPublication))&&($isobject(gSection)))>
#[ new grid set grid = ##class(dt.cms.support.Utilities).getCurrentGrid(gSection) ]#
<csp:if condition=($isobject(grid))>
#[ new pageLayout set pageLayout = gStory.defaultFullLayout.pageLayoutID ]#
<csp:if condition=($isobject(pageLayout))>
<csp:comment> Items defaults to 50 if not passed via query string. </csp:comment>
#[ new stories set stories = ##class(custom.rg.TopSlotStories).getTopStories(gPublication.getName(), gSection.getName(), pageLayout.name, grid.name, areas, $get(%request.Data("items", 1), 50)) ]#
<csp:if condition=(stories.Next())>
#[ new count, current set count = stories.Count() set current = stories.FindObjectId(gStory.%Id()) ]#
<csp:if condition='($length(current))&&(count>1)'>
#[ new prev, next set prev = stories.GetPrevious(current) set next = stories.GetNext(current) ]#
<div class="pager">
<div class="pages"><i>Story #(current)# of #(count)#</i></div>
<div class="end clear">
<p class="end01">
<csp:if condition=($isobject(prev))>
<b>Previous Story:</b>
<br>
<dti:story:link cid="#(prev.%Id())#">#(##class(csp.web.assets.methods.story).headline(prev))#</dti:story:link>
<csp:else>
&nbsp;
</csp:if>
</p> <!-- /.end01 -->
<hr>
<p class="end02">
<csp:if condition=($isobject(next))>
<b>Next Story:</b>
<br>
<dti:story:link cid="#(next.%Id())#">#(##class(csp.web.assets.methods.story).headline(next))#</dti:story:link>
<csp:else>
&nbsp;
</csp:if>
</p> <!-- /.end02 -->
</div> <!-- /.end -->
</div> <!-- /.pager -->
#[ kill prev, next ]#
</csp:if>
#[ kill count, current ]#
</csp:if>
#[ kill stories ]#
</csp:if>
#[ kill pageLayout ]#
</csp:if>
</csp:if>
</csp:if>
#[ kill areas ]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment