We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5154
    • 15 Posts
    I guess there is something simple and fundamental I am missing here so thanks for your patience.

    I am embedding a snippet to do some Ditto processing in a chunk, this is the Ditto tpl
    <!--
    [+course-date-begin+] 
    [+course-date-end+]
    -->
    [[shortCourseSnippet? &course_id=`[+course id+]` &thispage=`[*pagetitle*]`]]
    

    I assume that I need the placeholders within the html comment because the snippet isn't cached, without the comments nothing displays. (this was true when I used PHx within the chunk too)

    So, going by the documentation I tried this;
     [!shortCourseSnippet? &course_id=`[+course id+]` &thispage=`[*pagetitle*]`!]
    

    and that just printed itself to my page (multiple times), ie no processing happened

    so what's wrong here?

    the first example works perfectly, if a little counter intuitively.

    The output I am trying to produce looks like this;

    Sat 14 July – Sun 15 July
    Sat 18 August – Sun 19 August
    Sat 22 September – Sun 23 September

    where the dates are only listed for a particular course (identified by the TV 'course id' above)
    [ed. note: Chris Pink last edited this post 14 years, 5 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Where are those placeholder being set? In your shortCourseSnippet? Or does your snippet output the information?
        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
        • 5154
        • 15 Posts
        the placeholders in the comments are in the chunk (Ditto tpl)

        The output works OK but only if the html comment is there and the snippet is run uncached.

        Can I assume (I gave it a little more thought) that I can't run a uncached snippet from within a Ditto template?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That does not answer my question. Where are the placeholders added to the $modx->placeholders array? Where do their values come from? A placeholder is useless unless it's set somewhere. The placeholder tags get replaced with their value from the $modx->placeholders array. All those comment tags are doing is preventing the browser from displaying the tags, or whatever the tags are getting replaced with. They have no effect at all on MODx processing.
            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