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

    i just don’t know why, i have an error from this ditto call:
        [[Ditto? &parents=`[*parent*]` &depth=`1` &tpl=`@CODE:<li><a href='[~[+id+]~]' title='Voir la page [+pagetitle+]'>[+pagetitle+]</a> | </li>` &tplLast=`@CODE:<li><a href='[~[+id+]~]' title='Voir la page [+pagetitle+]'>[+pagetitle+]</a> | </li>` ]]
     

    here is the error:
    [tt]
    &tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.
    &tpllast either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.
    [/tt]

    my template does contain placeholders ([+id+] and [+pagetitle+]), so maybe it’s my code block which is invalid...
    But i don’t know why huh
    If someone could help...
      • 25663 MODX Staff
      • 12,272 Posts
      I’d try moving the templates into a regular chunk as that typically works without issue. I suspect the single-quotes are tripping things up.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 5727
        • 160 Posts
        Quote from: nauar at Sep 27, 2008, 04:17 AM

        Hello,

        i just don’t know why, i have an error from this ditto call:
            [[Ditto? &parents=`[*parent*]` &depth=`1` &tpl=`@CODE:<li><a href='[~[+id+]~]' title='Voir la page [+pagetitle+]'>[+pagetitle+]</a> | </li>` &tplLast=`@CODE:<li><a href='[~[+id+]~]' title='Voir la page [+pagetitle+]'>[+pagetitle+]</a> | </li>` ]]
         


        The problem is that you cannot use the character "&" inside a parameter. So &nbsp; is breaking it.
          Olivier Deland
          Montreal, Canada - Web Developer
          • 21026
          • 53 Posts
          @rthrash
          Quote from: rthrash at Sep 27, 2008, 07:36 AM

          I suspect the single-quotes are tripping things up.
          I try both single and double quotes but it don’t resolve the problem.

          Now i put my template in a chunk and it works!

          Thanks for help!

          @ConseilsWeb
          i’m pretty sure i had test my template with and whithout &nbsp; to know if the problem came with it.
          I’ll test it again.
          Thanks
            • 36592
            • 970 Posts
            I think you can not use ’=’, ’?’ and ’&’ in your snippet parameter.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That is correct; they are used as parameter delimiters in a snippet call.

              If you don’t like the idea of cluttering up the siteCache.idx.php cache file with lots of chunk templates, you can also use a single configuration file, in assets/snippets/ditto/configs/filename.config.php, and use standard PHP variable syntax:
              $tpl='@CODE:<li><a href='[~[+id+]~]' title='Voir la page [+pagetitle+]'>[+pagetitle+]</a> | </li>';

              All of your parameters can go in this file, leaving just one for the Ditto call: &config=`filename`; the .config.php part is added automatically by the snippet. You could also use &config=`@FILE: path/to/config/file` if you want to use a different location and filename convention. Or even use separate files for the templates, and use &tpl=`@FILE:path/to/template/file`. As is usual with MODx, you have a variety of methods to choose from cool
                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
                • 36416
                • 589 Posts
                Quote from: sottwell at Sep 28, 2008, 11:51 PM

                If you don’t like the idea of cluttering up the siteCache.idx.php cache file with lots of chunk templates, you can also use a single configuration file, in assets/snippets/ditto/configs/filename.config.php, and use standard PHP variable syntax:

                But please do use double quotes inside template-generated HTML chunks... wink
                  • 21026
                  • 53 Posts
                  Thanks for all your advices and explanation, i will follow them in the future
                  and... i promise to don’t use single quotes inside template-generated HTML chunks grin

                  Thanks again. smiley