tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/14928-script-formats-displaytool-truncatingCascade CMS: Discussion 2018-10-18T20:37:22Ztag:help-archives.hannonhill.com,2010-02-09:Comment/352719902014-11-13T18:53:11Z2014-11-13T18:53:11ZScript Formats: DisplayTool & Truncating<div><p>Hi Chris,</p>
<p>Because <code>getChild</code> returns an Element object, you
need to pass the <code>value</code> property into the Display
Tool:</p>
<pre>
<code><span>${_DisplayTool.truncate($short_dec.value,33,"...",true)}</span></code>
</pre>
<p>Note: Truncating HTML (WYSIWYG) content using the Display Tool
can result in open HTML tags because it does not account for them.
If you do run into this issue, you best options would be to either
use the Display Tool's <code>stripTags</code> method to remove all
tags from the content, or you can use <a href=
"https://github.com/hannonhill/Velocity-Cookbook/blob/master/Macros/abbreviateHtmlString.vm">
this truncation macro</a> we came up with to help truncate HTML
content by closing open tags.</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/352719902014-11-19T17:02:36Z2014-11-19T17:02:36ZScript Formats: DisplayTool & Truncating<div><p>I am still struggling with this, every time I look at a variable
I just make 30 different ways of displaying it and use the one that
works. :) I will get it eventually.</p>
<p>Thanks for your help though, worked like a champ!</p></div>Chris