tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/13320-entityopenact-with-escaped-ampersand-in-velocity-formatCascade CMS: Discussion 2018-10-18T20:37:47Ztag:help-archives.hannonhill.com,2010-02-09:Comment/386859742015-12-13T18:17:58Z2015-12-13T18:18:19Zentity/open.act with escaped ampersand in velocity format<div><p>Hi Jason,</p>
<p>Use <code>$_EscapeTool.url</code> in the place of
<code>&</code> like this:</p>
<pre>
<a href="http://myorg.edu:1234/entity/open.act?id=$assetId${_EscapeTool.url}type=folder">Open Folder</a>
</pre>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/386859742015-12-13T19:10:51Z2015-12-13T19:10:51Zentity/open.act with escaped ampersand in velocity format<div><p>Wing,</p>
<p>This doesn't work for us for some reason. Also, my apologies -
but it looks like my original message got reformatted. So, i've
attached the velocity format that works to check in in Velocity
(but doesn't work in Cascade when put into a browser. And the
second attachment outputs URLs that work in Cascade but Velocity
doesn't work for us. Your suggestion of using ${_EscapeTool.url} or
$_EscapeTool.url outputs nothing but these exact strings.
${_EscapeTool.url('&')} outputs %26 and that works with
Velocity but the folder doesn't open in Cascade - same behavior as
we have now. Attachment 3 has our desired output.</p>
<p>Thanks for any ideas; and thanks Wing.</p></div>jason.c.hoyttag:help-archives.hannonhill.com,2010-02-09:Comment/386859742015-12-14T02:16:34Z2015-12-14T02:24:04Zentity/open.act with escaped ampersand in velocity format<div><p>Jason,</p>
<p>I did not realize that you want to produce links that work both
inside and outside Cascade. It is almost impossible to output
<code>&</code> in Velocity; well, with a few exceptions.</p>
<p>Here is what I can come up with:</p>
<pre>
#set( $assetId = '34501ab08b7f08560135b47cc2fd7b74' )
#set( $xhref = "https://myorg.edu:1234/entity/open.act?id=${assetId}&amp;type=folder" )
#set( $ihref = $xhref.replace( '&amp;', '&' ) )
[system-view:external]<a href="${xhref}">Open folder</a>[/system-view:external]
[system-view:internal]<!--#protect<a href="${ihref}" target="_blank">Open folder</a>#protect-->[/system-view:internal]
</pre>
<p>Note that:</p>
<ol>
<li>I have to use pseudo tags to produce two different links, one
for external publishing, the other for Cascade-internal
use.<br></li>
<li>I use <code>#protect</code> so that I can output
<code>&</code>.<br></li>
<li>I have to use the <code>target</code> attribute to put the new
iframe in a different tab or window. Without this, the opened
iframe will be embedded in the original iframe containing the page.
Remove the attribute to see for yourself.</li>
</ol>
<p>Hope that this helps.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/386859742015-12-14T07:57:49Z2015-12-14T07:57:49Zentity/open.act with escaped ampersand in velocity format<div><p>Wing - thanks so much for your help. That wasn't working for us
either (maybe it was our Output type serialization type (just
changed from xml to html) but you definitely put me on the right
track. Here is what worked for us:</p>
<pre>
<code><content><![CDATA[#protect-top"${path}","https://server.cascadeserver.com/entity/open.act?id=${id}&type=folder",<!--cascade-skip-->#protect-top]]></content></code>
</pre>
<p>Would not have solved this without your assistance. Thanks so
much.</p></div>jason.c.hoyt