I’m trying to get Ditto to serve up documents from a folder/container as the source for a Ticker widget. Has anyone done this? My main issue has to do with the delimiter I think. I have two documents in the folder and they both come up in the ticker. Using the default delimiter of "||" I’ve put this at the end of each content item, and it’s still not working. I’d rather not have to rely on this approach though, since the user would have to remember to do this. I’m using Ditto 2.0.2 and MODx 0.9.5, my folder is ID=51. Here’s my code in the TV:
[[Ditto? &parents=`51` &tpl=`simpleContent` &phx=`0`]] // I was tinkering with phx=1 to see if that helped.
and in "simpleContent" chunk, it’s simply: [+content+]
Any help would be great. Thanks
Well, they both work the same: they both give me the 2 documents in the folder concatenated together. So, in the javascript source, it’s only got a single "o.addMessage" instead of 2. To contrast, I can input the following in the TV for the document and it works fine: "Content 1 || Content 2" since the "||" is the delimiter.
As I mentioned earlier, I tried using "||" at the end of each of the 2 documents and it didn’t work...still concatenated both.
OK, I was able to "kluge" a solution, but it’s not ideal. To recap:
- parent doc id (23) contains 2 docs (24 and 25)
- TV "Testimonial" which uses a Ticker widget
- source of TV should be any/all documents under parent (23), so that what shows is a fading set of docs, one at a time
- chunk "Testimonial": [+content+] - [+pagetitle+]
I tried using [[Ditto? &parents=`23` &tpl=`Testimonial`]] as the TV source, but what happened is that Ditto returned the docs as a single set of HTML and the TV therefore saw it as a single doc. So I tried adding the delimiter in the docs, and also in the chunk, but no matter where I put the delimiter, it was not being taken into account by the TV. The only way I could get the delimiter to be used was to "hard code" it in the TV, like:
<content 1> || <content 2>
So this is what works:
[[Ditto? &documents=`24` &tpl=`Testimonial` &phx=`1`]] || [[Ditto? &documents=`25` &tpl=`Testimonial` &phx=`1`]]
There has got to be a something more end user friendly, because ultimately I want whatever document appears under the parent (23) to automatically show in the Ticker. Anyone?
What you need to do is have 2 templates. &tpl would have || at the end and then tplLast would not. This would let you use one call. BTW, phx is enabled (1) by default so you don’t need to add &phx=`1`.
Actually, I had tried this and also had tried putting "||" at the end of the doc. What happens is the Ditto call brings back both child docs with "||" between the content, but if you look at the javascript in the page, it only makes one call "o.addMessage". The Ticker must make multiple "o.addMessage" calls in order to display multiple docs. So it seems that the delimiter is only interpreted if it is in the TV.
Thanks for the phx tip.
Does it work with an [!uncached!] snippet call?