Skip to content

Instantly share code, notes, and snippets.

@mhulse
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhulse/5949d3cc50e706487d92 to your computer and use it in GitHub Desktop.
Save mhulse/5949d3cc50e706487d92 to your computer and use it in GitHub Desktop.
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Create a story URL programatically using COS.
#[ new id set id = $get(%request.Data("id", 1)) ]#
<csp:if condition='$number((id \ 1), 0)'>
<script language="cache" runat="server">
new publication, section, story, layout
set publication = ##class(dt.cms.schema.Publication).%OpenId(##class(dt.cms.support.Utilities).getPublicationID("rg")) // Publication name is "rg".
set section = ##class(dt.cms.schema.Section).%OpenId(##class(dt.cms.support.Rules).getSectionID(publication, "sports")) // Section name is "sports".
set story = ##class(dt.cms.schema.CMSStory).%OpenId(id) // CMSStory ID
set layout = ##class(dt.cms.support.Rules).getFullLayoutFromName("", "Multimedia", section, story, 0) // Where "Multimedia" is the name of your full story layout.
</script>
<a href="#(story.getLink(section, layout))#">#(story.getName())#</a>
</csp:if>
#[ kill id, publication, section, story, layout ]#
<script language="cache" runat="server">
write !, "<pre>"
try {
set currIO = ##class(%SYS.NLS.Device).SetIO("HTML")
zwrite
}
catch {
write "ERROR: ", $ZERROR
}
if $get(currIO) '= "" {
do ##class(%SYS.NLS.Device).SetIO(currIO)
}
write "</pre>"
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment