We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19309
    • 49 Posts
    I have some resources which I use to save information of downloadable documents (via TVs). I also have a TV called [*related-downloads*] which is used to pick one or more downloads for a given page. (I use ddTree to receive a list of downloads to choose from when editing a page.) Now I want to display these downloads via Ditto.

    The problem: When I insert the resource IDs to be shown, it works perfectly.

    [[Ditto? &documents=`21,22` &showPublishedOnly=`1` &sortBy=`pagetitle` &sortDir=`ASC` &tpl=`related-download-list` &tplFirst=`related-download-list-first` &language=`german`]]


    But as soon as I change the “21,22” to the [*related-downloads*] TV, I receive an error message when I try to load the page.

    [[Ditto? &documents=`[*related-downloads*]` &showPublishedOnly=`1` &sortBy=`pagetitle` &sortDir=`ASC` &tpl=`related-download-list` &tplFirst=`related-download-list-first` &language=`german`]]


    This is the error message I get:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’[*related-downloads*]) AND sc.published=1 AND sc.deleted=0) AND’ at line 3 »
    SQL: SELECT DISTINCT sc.id FROM `d00ccd19`.`modx_site_content` sc LEFT JOIN `d00ccd19`.`modx_document_groups` dg on dg.document = sc.id WHERE (sc.id IN ([*related-downloads*]) AND sc.published=1 AND sc.deleted=0) AND (sc.privateweb=0) GROUP BY sc.id

    What I don’t understand:

    1. The output of the TV [*related-downloads*] is correct. When I just insert the TV in the template, “21,22” is displayed exactly as it should be. So Ditto seems to have a problem with the TV itself, since it obviously doesn’t even come to the point where it should receive the TV output.

    2. In one of my test installations the same scenario (just with slightly different TV names) works perfectly with the TV inside the &documents parameter.

    Anyone has any ideas how to solve this?
      • 16278
      • 928 Posts
      Perhaps the answer is in the question?
      (just with slightly different TV names
      If a different name for the TV works, use it! Possibly the problem with "related-downloads" is that while it may be a valid TV name, it’s not a valid PHP variable name.
      wink KP
        • 19309
        • 49 Posts
        Quote from: kp52 at Jan 07, 2010, 01:56 PM
        If a different name for the TV works, use it!

        I already did, but no change. It is the same error message,just with another TV name sad
          • 36416
          • 589 Posts
          Quote from: MichaelvanLaar at Jan 07, 2010, 03:26 PM

          Quote from: kp52 at Jan 07, 2010, 01:56 PM
          If a different name for the TV works, use it!
          I already did, but no change. It is the same error message,just with another TV name sad

          Try naming your template variables without dashes...
            • 19309
            • 49 Posts
            Quote from: Eol at Jan 07, 2010, 03:58 PM
            Try naming your template variables without dashes...

            Also did that. No changes. By the way, the TV name used in the working test installation was [*download-select*]. Test and productive installation are on the same server. The only difference is the fact that they use different databases.

            I will try with another installation.
              • 19309
              • 49 Posts
              A little testing helped me finding the source of my troubles with the Ditto call:

              It seems that Ditto doesn’t like template variables inside the Ditto call, when the call is placed inside a chunk, and not directly inside a template.

              Since I always use different chunks for my different template parts, I placed the Ditto call in the {{template-sidebar}} chunk. When doing so I receive the above mentioned error message. Using the very same Ditto call directly inside the template works perfectly.