We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38259
    • 2 Posts
    Greetings,
    I am trying to display some documents in a summary by the use of Ditto, e.g. showing their title, introtext, and some variables. It's a multilingual solution, where some of the documents are translated, others not or partly.

    Translations are in custom TVs corresponding to the standard fields and called thus: [*[%lang%]introtext*] with the EasyLingual plugin taking care of the switch.

    I need a fallback for the ones not translated so that those results will not be empty. I figured populating the TVs with a default value picked from the standard field, eg introtext, by defining the custom TV to use this as default value would be a way: "[*introtext*]". This works super with a single document without Ditto.

    However when using Ditto to display several documents in a summary page, all documents with the default field value, eg "[*introtext*]" or "[*title*]" gets the introtext and title of the summary page itself. Which in a way makes sense. It is obviously a matter of when and what gets parsed, but I cannot find a way out.

    The site is on Evolution 1.0.15, reluctant to upgrade o Revolution just to take care of this.
    Would Revo even have a way to manage this scenario with the getResources?

    Most grateful for any hint regarding this antique setup wink
      • 36416
      • 589 Posts
      Quote from: modness at Jun 12, 2015, 05:26 AM
      However when using Ditto to display several documents in a summary page, all documents with the default field value, eg "[*introtext*]" or "[*title*]" gets the introtext and title of the summary page itself. Which in a way makes sense. It is obviously a matter of when and what gets parsed, but I cannot find a way out.

      I've never seen EasyLingual, but correct Ditto field syntax is:
      [+introtext+] [+pagetitle+] ...etc.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Indeed. If you use the resource field tag, [[*...]] or [*...*] it will always be the value of the current resource, that's what that tag is for. Within Ditto, getResources, or any of the listing snippets you need to use the placeholder tags, [[+...]] or [+...+]. The snippet then replaces that with the value from the resource it's processing from its list.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org