We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    That was simple. Reverse the snippet cache setting to
    [!Ditto? &tpl=`breeder_personality` &parents=`6` &display=`all` &filter=`id,[[baby_link]],1`!]


    You actually dont need the filter. Just use the documents parameter rather than the parents:
    [!Ditto? &documents=`[[baby_link]]` &tpl=`breeder_personality` !]
      [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]
      • 10226
      • 412 Posts
      DERR!@ *RTFM*

      OK

      Well either call works fine, except our target document is not getting passed on. When calling doc 45 ( the personality page that displays in the iframe ) I have it set to show [!baby_link!] and [[baby_link]]

      Here is the actual output - well stripped down a bit... the mentioned variants of baby_link should be displaying after the 1 - or 2 -, dual no docs found because I currently have both ditto calls in there for testing.

      <div class="slim">
      <h1> 1 - </h1><br/>
      <h1> 2 - </h1><br/>
      <p>No documents found.</p>
      <p>No documents found.</p>
      </div>


      and template source

      <h1> 1 - [!baby_link!]</h1><br/>
      <h1> 2 - [+baby_link+]</h1><br/>
      [[Ditto? &tpl=`breeder_personality` &parents=`6` &display=`all` &filter=`id,[!baby_link!],1` &debug=`1`]]
      [!Ditto? &documents=`[[baby_link]]` &tpl=`breeder_personality` !]


      *boggled*
        • 7231
        • 4,205 Posts
        did you create the baby_link snippet?

        <?php
        $baby_link = isset($_GET['baby_link']) ? $_GET['baby_link'] : '';
        return $baby_link;
        ?>


        Do you have PHx installed? If so you could use it to get the field as well with a custom modifier as well:
        http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:get
          [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&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 10226
          • 412 Posts
          I did add the snippet, and I did take a look at PHx, wasn’t sure if I needed it just yet. I also ran across the setPlaceholder function, not too sure about that either.

          I guess I will go with PHx, but not just yet, I have other stuff to do. I hope to get the site back online tonight. smiley

          Thanks!
            • 7231
            • 4,205 Posts
            It just came to me, maybe the $_GET is not working because of Friendly URLs? In my test environment I have it turned off.

            <a title="Cockatiel" rel="lightbox" href="personality.php?baby_link=35">Cockatiel</a>
            Here it seems that the URL is right. Have you tried posting the URL directly into the browser. Could lightbox be stripping the url?

            There is also the DItto Request extender that allows parameters to be set by the URL:
            http://ditto.modxcms.com/files/assets/snippets/ditto/extenders/request-extender-inc-php.html

              [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&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 10226
              • 412 Posts
              No, posting the URL direct does not work, but if I hard-code the link in somewhere it does work.. can’t recall where, oh on the actual ditto call...

              As for the extender link, I saw that too. I’ll have to look later. I found a few more pages of content on MSN, so I am working on that.. then it will be time for bed, so tomorrow smiley

              Thanks!
                • 10226
                • 412 Posts
                Lets go back a bit here... I read everything with a clear head just now. The [[babylink]] snippet returns the id passed in the url. So taking that a step further, how do we place that back into the TV?

                I have played around, but results are lame... but I don’t understand anything codelike unless I have docs and examples laugh

                <?php
                $baby_link = isset($_GET['baby_link']) ? $_GET['baby_link'] : '';
                return $baby_link;
                void setPlaceholder(babylink, $baby_link);
                ?>


                Thanks
                  • 7231
                  • 4,205 Posts
                  So taking that a step further, how do we place that back into the TV?
                  Why do we need to do that? The purpose here is to use it in a Ditto call. How it works is that $_GET[’baby_link’] extracts the value of the parameter named baby_link from the URL. Then return $baby_link; outputs that value. It is very simple, there is no logic involved in the code just a straight input to output.

                  Wherever you place the [[baby_link]] snippet you should see the value of the baby_link parameter from the URL of this document.

                  So if we use this snippet in a Ditto call the value from the snippet will be output and used in the call. In the situation you describe you need to pass the link ID to a new document that will open in an iFrame (I gather using lightbox). We saw that the link to the iFrame is being generated with the added parameters in the URL. But the value is not making it to the Ditto call.

                  Which lightbox are you using? There is a stand alone js named lightbox, and there is one that works with scriptaculous. Maybe it could be a JS conflict between this script and the mootools from MODx.

                  Is there a url to see the site? Maybe I am not following properly the intention or methods.
                    [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&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 10226
                    • 412 Posts
                    ok.. twice in this topic I have won the dumbass award!

                    here is the site - well the page we were dealing with http://sweetskies.fruitwerks.us/babies.php

                    Click on the bird type in the listing... I have to say doing this site the second time around has been interesting. Found different ways to do stuff. I have actually learned a lot. Amazingly it looks almost he same, but of couse there are all kinds of issues still. Also my wife has me constantly changing things, or telling me to do something so I do, and she wanted it totally different. Oh Well.

                    I have to be going, If anyone wants to see any code, let me know.

                    Thanks Again!

                      • 7231
                      • 4,205 Posts
                      Am I mistaken or is it working? grin

                      I remember this site. What a shame that it was lost, great that you are able to rebuild it.
                        [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&#39;t know what it is.
                        Do you, Mr. Jones? - [bob dylan]