Print a DOM-Substring as plain text
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
06-21-2010
03:35 AM
Sometimes it is desired to display the beginning sequence of an article (e.g. on an overview page).
If the article itself was written using the DOM-editor, this is the way to do it:
$CMS_SET(text, st_domtext.toText(false).substring(0, 100))$
$CMS_VALUE(text.substring(0, text.lastIndexOf(" ")))$
the method "toText(false)" returns the contents of the DOM-editor als plain text. The example above renders the first 100 characters of the contents of the DOM-editor but will not truncate in the middle of a word.
Labels
2 Comments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.