We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25201
    • 94 Posts
    Hi,

    I try to do the simplest Ditto to teach myself Ditto.

    So I like to generate a list of page titles from a container with documents. I created a chunk named ’menuIndex’ just having this:

    [+pagetitle+]


    And use ditto as follows:

    [[Ditto?&parents=`17`&depth=`1`&tpl=`menuIndex`&display=`all`]]

    But I get a MODX parse error:

    Error: array_values() [function.array-values]: The argument should be an array
    Error type/ Nr.: Warning - 2
    File: /some/path/includes/document.parser.class.inc.php(748) : eval()’d code
    Line: 372

    Am I missing something? My approach too simple?

    Thanks!

    rnd

      • 7455
      • 2,204 Posts
      try putting a space between the ? and the & somtimes helps
        follow me on twitter: @dimmy01
        • 25201
        • 94 Posts
        Quote from: Dimmy at Sep 20, 2007, 08:57 AM

        try putting a space between the ? and the & somtimes helps

        Nope doesn’t help.

        rnd
          • 7231
          • 4,205 Posts
          Maybe something wrong with your Ditto. I just tried your exact call with the chunk and it worked like a charm.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 25201
            • 94 Posts
            Quote from: dev_cw at Sep 20, 2007, 01:18 PM

            Maybe something wrong with your Ditto. I just tried your exact call with the chunk and it worked like a charm.

            Thanks that comment pointed me to check out my installation. As Ditto is labelled a Core snippet on the modx website I assumed the version I’m running, 0.9.5, had it built in.. not so.. now upgraded to Ditto 2.0.2 and all is fine.

            Cool.

            rnd
              • 10226
              • 412 Posts
              Just a useless bit since this has been solved.. but on my Ditto calls, I never use the & after the ? never had a prob.
                • 7231
                • 4,205 Posts
                From what I understand the & is optional and is used for readability and to help deal with spaces. You could do:

                snippetName?par1=`value`par2=`value` ->this one has no spaces

                or...

                snippetName? &par1=`value` &par2=`value` ->notice the spaces

                This is my understanding but I have not tested it, I just stick to using & since it make it easier to be constant. Please correct me if I am wrong. undecided
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Snippet parameters are handled in the same way a URL query string is handled. The first option can immediately follow the ? with no white space, but all following options must have the &. Spaces are optional; the ` ` delimiters are also optional if there are no spaces in the option value. Best practice is [[SnippetName? &option=`value` &option=`value`]]
                    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
                    • 7231
                    • 4,205 Posts
                    Thanks for clearing that up for me. I was off in my assumption shocked
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don't know what it is.
                      Do you, Mr. Jones? - [bob dylan]