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

    either I have a strange problem here or I got a blackout.

    I have one doc with a snippet call like this:
    [!Ditto? &display=20 &parents=`13` &tpl=`veranTeaser` &sortBy=`menuindex` &sortDir=`ASC` &showInMenuOnly=`1`!]


    the chunk "[tt]veranTeaser[/tt]" looks like this:
    <div class="veranteaser" id="ditto_item_[+id+]">
        <p class="datum">[[getVeranDateString? &anfang=`[+eventStart+]` &ende=`[+eventEnde+]` &tage=`true` &zeit=`true`]]</p>
        <h2 class="pageTitle">[+pagetitle+]</h2>
        <div class="introText">
    [[showPreview? &spvImageName=[+vorschauBild+]]]
    [+spvImage+]
    [+introtext+] <a href="[~[+id+]~]">Weiterlesen ...</a></div>
    </div><br/>
    


    The problem lies in the line with [tt]<p class="datum">[/tt]. As you can see, I use the TV values of the documents under ditto’s parents. These documents all are of document template "[tt]Veranstaltung[/tt]" which includes (among others) these two TVs "[tt]eventStart[/tt]" and "[tt]eventEnde[/tt]". The values are passed to a snippet wich in turn formats the output. This works very fine as you can see here: http://www.transeus.de/tangobruecke/index.php?id=4 The calling document is of template "[tt]standard[/tt]" wich does not have any TV.

    Now, I put the same ditto call on a different page for testing purposes. This test page has the template "[tt]Veranstaltung[/tt]". And when I now look at the ouput, all dates are output as "Donnerstag, 01.01.1970; 00:59 Uhr", regardless of the given TV value.

    Ditto’s excellent debug console tells me that ditto gets the correct date values from the TVs. So it must be in some way the snippet call which produces the problem. But Why?

    What is this? Thanks for any tipps
    Martin
      • 22303 MODX Staff
      • 10,725 Posts
      Because, at the moment, placeholders are executed after snippets. This means that the snippet call will receive the complete placeholder tags as the parameter values rather than the value of the placeholder.
        • 10313
        • 375 Posts
        Okay, but why does it work on one template but not on a different one?

        Additionally, now I can make it even more complicated: As you might have noticed, my site works with events. I have that one special page where all the coming events are listed. It’s template is "standard" and so it works fine, as described above.
        Now I want to show the next three events on all pages in a side column.

        This works (meaning the correct dates are output) as long as

        • the template is [tt]stanard[/tt] and
        • ditto (with the same &parents) is not called in the main content area

        I am totally confused about that ...