Script Formats: DisplayTool & Truncating

Chris's Avatar


13 Nov, 2014 05:48 PM

I would like to grab the copy ("main-content") from different pages via a list loop. Then truncate each down after 3 or so sentences.

I can grab the "main-content". I tried printing it out and it worked wonderfully for each list item.

#set ( $short_dec = $item.getChild("system-data-structure").getChild("main-content") )

I then try to truncate it...


...and it prints out [Element: ] without an error!?!?

I presume I am making a simple error here, but am unable to figure out what I am doing wrong.

Thanks for the help again! :)

  1. 1 Posted by Ryan Griffith on 13 Nov, 2014 06:53 PM

    Ryan Griffith's Avatar

    Hi Chris,

    Because getChild returns an Element object, you need to pass the value property into the Display Tool:


    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 stripTags method to remove all tags from the content, or you can use this truncation macro we came up with to help truncate HTML content by closing open tags.

    Please let me know if you have any questions.


  2. 2 Posted by Chris on 19 Nov, 2014 05:02 PM

    Chris's Avatar

    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.

    Thanks for your help though, worked like a champ!

  3. Chris closed this discussion on 19 Nov, 2014 05:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac