Saturday, December 04, 2010

MODx Ditto Create A Short Introtext - Shorter Intro Text Summary

After trying various ways to shorten the amout of text from the default to a smaller amount like 100 or so characters, I found a simple way to do it.

I tried using PHx, with the code syntax of +introtext:character_limit=`30`, but that didn't work. I got the php script to run of course but it did not shorten the summary/introtext. Very fustrating. Also tried the tuncing functions from Ditto and MODx but those didn't do the job either.

The solution was faily simple. In my case, and I hope in yours to so this post turns out to be helpful to you, the line of code that worked in the template was this:


What this line did was if there's introtext (summary) text for the document, then trim that down to 120 characters. The default of course was to use text out of the content if there was not intotext/summary for the document. The ellipsis part of the code is applied to both the +introtext and the +content. My document and many others have a summary (introtext) and I did not want to remove this. The line as I have it will trim both the intro text and the content, whichever is uswed for the particular document that's being used for the dynamic page.

Another possible method to truncate the summary introtext I found shortly after making this post was the following.