tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/13071-add-custom-js-and-css-files-within-data-definitionsCascade CMS: Discussion 2014-06-20T19:57:18Ztag:help-archives.hannonhill.com,2010-02-09:Comment/334731482014-06-20T11:14:34Z2014-06-20T11:14:34ZAdd Custom Js and Css Files within Data Definitions<div><p>Hi Adam,</p>
<p>You should be able to simply copy the Format you provided and
replace the <code><script></code> tag with a
<code><link></code> tag and associated attributes. Everything
else should remain the same.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/334731482014-06-20T19:14:13Z2014-06-20T19:33:55ZAdd Custom Js and Css Files within Data Definitions<div><p>Hey Adam --</p>
<p>FWIW, you can do some if type checking with an XPath expression.
It may come in handy to you in the future. An example would be if I
wrote your code this way:</p>
<pre>
<code>#set ( $sib = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block") )
#set ( $callingPage = $_XPathTool.selectSingleNode($sib, "calling-page") )
#if ( $_XPathTool.selectSingleNode($callingPage, "system-page/system-data-structure[@definition-path='Program Interior Page']") )
#set ( $pageData = $_XPathTool.selectSingleNode($sib, "system-page[name='index' and not(@reference)]/system-data-structure") )
#else
#set ( $pageData = $_XPathTool.selectSingleNode($callingPage, "system-page/system-data-structure") )
#end
#set ( $javascriptFiles = $_XPathTool.selectNodes($pageData, "file[path!='/']/link") )
#if ( $javascriptFiles.size() > 0 )
#foreach ( $js in $javascriptFiles )
<script src="${js.value}" type="text/javascript"></script>
#end
#else
<script src="https://philau.edu/business/inc/js/business.js" type="text/javascript"></script>
#end</code>
</pre>
<p>It's roughly the same length as the code you posted, it just
does the if statement on the Data Definition name in another
way.</p>
<p>Edit: I'm not sure why I switched the
<code><script></code> tags to <code><link></code> tags.
I switched them back.</p></div>Charlie Holdertag:help-archives.hannonhill.com,2010-02-09:Comment/334731482014-06-20T19:44:15Z2014-06-20T19:44:15ZAdd Custom Js and Css Files within Data Definitions<div><p>Thanks Charlie,<br>
I'll use this in the future. I was able to get the format working
by following Ryan's recommendation.</p>
<hr></div>Holsten, Adamtag:help-archives.hannonhill.com,2010-02-09:Comment/334731482014-06-20T19:57:16Z2014-06-20T19:57:16ZAdd Custom Js and Css Files within Data Definitions<div><p>Thank you for following up, Adam. I am glad to hear you were
able to get your Format working.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith