Hi, I’m trying to find a way of formatting some Ditto output so that the first x characters of the summary output are omitted.
This is the Ditto call I’m using, which grabs the first (summary) section of a news document:
[!Ditto? &documents=`175` &tpl=`ditto.dailynews1` &extenders=`summary` &truncLen=`390` &truncText=`Read More`!]
So it displays the first 390 characters, however I want it to miss off say the first 30 characters or so because these are a title which I don’t want repeated for this item (the title of the section is included with a previous Ditto call for a previous news item)
Is there any way this can be done?
I think you’d have to either hack the Ditto code or (better) write a custom PHX modifier to do that.
There should be a way of doing your "previous" link without hard-coding it into the summary field, though. I think that would be a much better solution in the long run.
Well, I’ve no idea how I’d do that so I guess it just isn’t possible then?
Maybe the writer of Ditto could include the parameter in the next version.
One idea though- is there some kind of markup that can be used to "hide" certain content from the Ditto call so that it just doesn’t see the title for example?
-
MODX Staff
- 2,502 Posts
Ditto is not in active development. The original developer has moved on to other things so I don’t expect that a new param will get added any time soon. You could create a very small snippet to modify the output in your custom ditto template that would do this.
It is pretty simple (I am hardly a php wizard). I would ask for help in the creating snippets forum and someone will likely be able to help you.
(You can do it in PHx but it eats process. Snippets are most often better and more efficient.)
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
Have you tried using Ditto’s [+previous+] and [+next+] placeholders in your Ditto Tpl chunk?
Also, if you post your ditto.dailynews1 chunk here, we might have some ideas.
Hi, this is the dailynews1 chunk / Ditto template that I’m using:
<div class="dailynews1box">[+summary+]<div class="readmoretext">[+link+]</div></div>
How would I use these other placeholders in conjunction with this?
Thanks
Quote from: galahad5 at Oct 06, 2009, 10:25 AM
Hi, this is the dailynews1 chunk / Ditto template that I’m using:
<div class="dailynews1box">[+summary+]<div class="readmoretext">[+link+]</div></div>
How would I use these other placeholders in conjunction with this?
Thanks
I’d use this for starters (without the extra stuff at the beginning of the summary field) and see what you get:
<div class="dailynews1box">[+previous+][+summary+][+next+]<div class="readmoretext">[+link+]</div></div>
Could you also post an example of your summary field from a doc so we can see what you’re doing?