Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created October 31, 2011 18:51
Show Gist options
  • Select an option

  • Save mhulse/1328449 to your computer and use it in GitHub Desktop.

Select an option

Save mhulse/1328449 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Web Facebook Image URI code example...
<csp:comment> FOR FACEBOOK: </csp:comment>
#[ new img set img = "" ]#
<csp:if condition=($data(gStory))>
#[ set img = ##class(csp.web.assets.methods.image).imageUri("288pxw", gStory) ]#
</csp:if>
<csp:if condition=($length(img))>
<link rel="image_src" href="http://registerguard.com#(..UnescapeHTML(img))#">
<csp:else>
<link rel="image_src" href="http://www3.registerguard.com/images/rg.png">
</csp:if>
<csp:comment> Global head include... Include on index.csp and story.csp templates. </csp:comment>
...
<dti:file:include base="assets" file="/includes/csp/facebook.inc.csp" />
...
<script language="cache" method="imageUri" arguments='field:%String="", cmsStory:dt.cms.schema.CMSStory=-1' returntype="%String" procedureblock="1">
set return = ""
if ($length(field) && $isobject(cmsStory)) {
set cmsPictureId = ##class(dt.cms.support.Rules).extractPicture(field, cmsStory, 0)
if (cmsPictureId '= -1) {
if ($isobject(##class(dt.cms.schema.CMSPicture).%OpenId(cmsPictureId))) {
set return = ##class(dt.cms.support.Rules).getSrcStream(cmsPictureId)
}
}
}
quit return
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment