I just installed Ditto 2 and now my old Ditto News Template does no more work correctly. The [+summary+] placeholder gives no output.
I read that there is a legacy support for +summary+ in Ditto 2, does that mean there is a newer alternative for it?
Impossible is nothing - with ModX
Yes. You need to add an extender to your snippet call. See
http://ditto.modxcms.com/files/assets/snippets/ditto/extenders/summary-extender-inc-php.html
You know I was thinking that it might be a good idea if all snippet developers started dealing with backwards-compatibility the same way. There are a ton of changes between ditto 1 and 2 for example, and it can mean that you need to make a lot of changes to all of your snippet calls if you upgrade. At the same time, as a developer it’s a drag to have to be saddled with supporting all past versions when you probably had good reasons for making the changes in the first place.
What if all snippet developers started adding a common parameter (&backwardsCompat=`1`) to all snippets that would when set run a function with a standard name that did all of the variable conversion and whatever else were necessary to make things work the old way. Then developers could keep the vast majority of this code in one standard place (keeping the new code neater), and users who don’t need the old methods would not set that parameter. If you had a site with a lot of old snippet calls and you wanted to upgrade them all you could set this parameter in the new snippet itself and that way avoid having to change all of your snippet calls throughout your site).
What do others think of this idea?
To me that sounds like a very good idea!
Right now, I’m just in an test environment so I can play around with the snippet calls. But I want to switch my site to a live environment soon and then snippet updates could become a risky game...
But back to my first post. If +summary+ is deprecated, which other placeholder could I use to get a summary displayed? Or is it still the only way?
Impossible is nothing - with ModX
Just use the extender parameter explained in the link below and [+summary+] will work the same as before.
Quote from: ZAP at Mar 10, 2007, 10:06 AM
Yes. You need to add an extender to your snippet call. See http://ditto.modxcms.com/files/assets/snippets/ditto/extenders/summary-extender-inc-php.html
I think what Konsum wants to know is:
Given that this extender is described as "legacy" - does that mean there’s another, more appropriate way to show an abbreviated form of the content field?
I’m curious too!
Yes, use the "Summary (introtext)" field in the manager which is the [+introtext+] placeholder in Ditto. It is far more efficient to only retrieve the introtext compared to retrieving the summary.