Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created June 13, 2012 22:28
Show Gist options
  • Save mhulse/2926882 to your computer and use it in GitHub Desktop.
Save mhulse/2926882 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Tested in 7.6: Example of COS/CSP count of </p> tags to insert in-story ads...
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="28222340">
<csp:if condition=($isobject(gStory))>
#[ new text set text = ##class(dt.cms.support.Rules).extractStoryElement("Text", gStory, 0) ]#
<csp:if condition=($length(text))>
<h1>With ad:</h1>
#($piece(text, "</p>", 1, 3) _ "</p>")#
<hr>
<p>Ad here...</p>
<hr>
#($piece(text, "</p>", 4, $length(text, "</p>")))#
<hr>
<h1>Full story:</h1>
#(text)#
</csp:if>
#[ kill text ]#
</csp:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment