We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17230
    • 35 Posts
    BobRay: Thanx! That’s exactly what I need to get things up and running as I also have to do some sorting and filtering based on specific criteria. I think I’ll get used to the new modx API smiley

    il_dandi: The answer to your question is 2 posts above. Just read wink

    EDIT: The call to my custom TV works now. I changed the syntax to
    [[*category]]


    with an asterix "*" instead of a plus "+" sign in the placeholder. So resource field are referred to with a plus sign and custom template variables are referred to with an asterix in chunks? Is that true in general? I don’t find nothing about that in the docs either... wink
      - Just because you're not paranoid doesn't mean they're not after you -
      • 3749
      • 24,544 Posts
      Quote from: Liquinaut at Feb 13, 2010, 02:47 PM

      with an asterisk "*" instead of a plus "+" sign in the placeholder. So resource field are referred to with a plus sign and custom template variables are referred to with an asterisk in chunks? Is that true in general? I don’t find nothing about that in the docs either... wink

      Terminology-wise [[+ ]] is a placeholder tag and [[* ]] is a resource tag.

      The resource tag (asterisk) gets Resource Fields (e.g. content, pagetitle, publishedon, any TVs) from the current Resource. With snippets like Ditto, that’s no good because you want the field from the document currently being aggregated, not the document the Ditto snippet tag is in. So Ditto (and other snippets) use placeholder tags (+) in their Tpl chunks to refer to the fields from the retrieved resources. This is true for Wayfinder and getResources as well.

      In many cases, I think they’re actually more like "pseudo" placeholders because they are processed by the snippet itself when it builds the output rather than by MODx.

      Hope this makes sense.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 17230
        • 35 Posts
        Yes, that makes sense, That’s how I was used to it in modx evo: use a "+" in chunks if the content the placeholder refers to is aggregated by a snippet like Ditto and use an "*" in the resource itself for accessing resource fields.

        What made me think here, is that I’m inside a chunk that Ditto uses to output the content! The category placeholder in my case refers to a custom TV from within the aggregated resource, not the resource the Ditto call is placed in. So that’s why I was using a "+" in the first place. But that wasn’t working for me.

        And now: When I use the placeholder with an "*" in the chunk (that’s the weird part), the TV from the aggregated resource is fetched correctly. When I use the "+" sign (as I was thinking I should), rendering of the page crashes on output...

        So I thought there was a major change in syntax usage for the paceholders... wink Or is there something wrong on my part?

        Thanx and greetings!

        Paul
          - Just because you're not paranoid doesn't mean they're not after you -
          • 3749
          • 24,544 Posts
          It doesn’t sound right to me. The page crashing suggests that you may have a malformed MODx tag or HTML tag somewhere.

          I’d start by validating the page at http://validator.w3.org/

          Once it validates, check the MODx tags for quotes instead of back-ticks, mismatched brackets, Evo-style tags, missing ? after name, etc.)
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 17230
            • 35 Posts
            Hm, I checked again and the value of the TV is not output correctly. It just aggregates the default value of the Variable, even if it’s is not assigned to the page.

            But still the page breaks when the syntax is used correctly with a "+".

            Since valid markup is a MUST for me, that’s definitely not the problem:

            http://www.artefactur.com
            http://www.artefactur.com/news.html

            This is the exact Ditto call I’m using at the moment and it looks good to me, too:

            [[!Ditto? &parents=`8` &display=`2` &total=`2` &orderBy=`createdon DESC` &tpl=`DittoHomeNewsTpl` &tplLast=`DittoHomeNewsTplLast`]]


            Other than that - I have no further snippet calls on these pages and the corresponding chunks - not before the basic calls don’t work out as expected wink


            Thanx for your help! Greetings,

            Paul
              - Just because you're not paranoid doesn't mean they're not after you -
              • 3749
              • 24,544 Posts
              You might post your Tpl chunks. Maybe something is off there.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 17230
                • 35 Posts
                This is the Template Chunk I’m using right now:
                <div class="blog_entry">
                	<div class="blog_head">
                		<p class="blog_date">[[+publishedon:strtotime:date=`%d.%m.%Y`]]</p>
                		<h3 class="blog_heading">[[+pagetitle]]</h3>
                	</div>
                	<p class="blog_category">Kategorie <a href="javascript:void(0)">[[+longtitle]]</a></p>
                	<div class="blog_text">[[+content]]</div>
                </div>
                <div class="content_divider"></div>


                When I replace longtitle with my custom TV category like this:
                <div class="blog_entry">
                	<div class="blog_head">
                		<p class="blog_date">[[+publishedon:strtotime:date=`%d.%m.%Y`]]</p>
                		<h3 class="blog_heading">[[+pagetitle]]</h3>
                	</div>
                	<p class="blog_category">Kategorie <a href="javascript:void(0)">[[+category]]</a></p>
                	<div class="blog_text">[[+content]]</div>
                </div>
                <div class="content_divider"></div>


                then the page breaks.

                Cheers, Paul

                  - Just because you&#39;re not paranoid doesn&#39;t mean they&#39;re not after you -
                  • 28215
                  • 4,149 Posts
                  Paul,

                  To be honest, I’d recommend using getResources, a much faster and more stable alternative to Ditto. Your code with it would look like this:

                  [[!getResources?
                    &parents=`8`
                    &limit=`2`
                    &sortby=`createdon` 
                    &sortdir=`DESC`
                    &tpl=`DittoHomeNewsTpl`
                    &tplLast=`DittoHomeNewsTplLast`
                    &tvPrefix=``
                  ]]
                  


                  More documentation can be found here: http://svn.modxcms.com/docs/display/ADDON/getResources
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 17230
                    • 35 Posts
                    getResources works just fine. I’ll stick with it! smiley

                    Thanx for all the help, I really appreciate the time and effort you spent here on this topic!

                    Greetings from Germany,

                    happy modx user Paul wink
                      - Just because you&#39;re not paranoid doesn&#39;t mean they&#39;re not after you -
                      • 26192
                      • 91 Posts
                      I’m trying to use getresources, I’ve installed it

                      why do you thinkt that with Ditto I show records and with getResources I show nothing?

                      [[Ditto? &parents=`12` &tpl=`tplNews` ]]

                      [[getResources?
                      &parents=`12`
                      &sortby=`createdon`
                      &sortdir=`DESC`
                      &tpl=`tplNews`
                      ]]