We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12584
    • 208 Posts
    I have ditto working no problem with all TV’s showing fine on the child pages. however on the parent page which outputs the chuck which summaries of all the child pages is there an existing tag that I can add to the chunk which puts a link back to the child page. At the moment I have to create the child page to get the ID then in the url TV I then need to add the page number in there.

    Can I not do something link for more info <a href ="[childdocID]"> click here</a>

    I hope this makes sense have scanned though many pages and unable to find an easier way to do this.

    Cheers

    Ian
      • 7231
      • 4,205 Posts
      If you are refering to making a link to a child from a DItto call, use the [+id+] placeholder to create a link to the document like this:
      <a href ="[~[+id+]~]"> click here</a>


      If you want to create an automatic link to the first child document, you could use a snippet to get the first child ID and then build the link. Here is an example:
      Create snippet, lets call it FirstChildID (note: this code is based on the FirstChildRedirect snippet)
      <?php
      $docid = (isset($docid))? $docid: $modx->documentIdentifier;
      
      $children= $modx->getActiveChildren($docid, 'menuindex', 'ASC');
      if (!$children === false) {
          $firstChild = $children[0];
          $firstChildId = $firstChild['id'];
      }
      return $firstChildId;
      ?>


      Then build the link like this:
      <a href ="[~[!FistChildID!]~]"> click here</a>


      Hope this helps
        [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]
        • 7455
        • 2,204 Posts
        and if you are in need of dynamic id’s from chilthren like this:

        main page that shows last (in this case blog items) pages from all bloggers I used dittoCall:
        [!Ditto? &parents=`[[getChildIds]]` &summarize=`5` &total=`all` &commentschunk=`FormBlogComments` &tpl=`nl_blog` &paginate=`1` &alwaysshow=`1`!]
        


        and for each blogger this:
        [[Ditto? &startID=`[*id*]` &summarize=`5` &total=`all` &commentschunk=`FormBlogComments` &tpl=`nl_blog` &paginate=`1` &alwaysshow=`1`]]
         
        item [+start+]<span class="tm">to</span>[+stop+] from [+total+] items <span class="route"><strong>::</strong></span>
        page [+previous+] [+pages+] [+next+]
        


        because the client can add new bloggers but can not edit the call (for messing all up reasons) the id’s in the first call are generated by a small snippet I made.:

        http://modxcms.com/GetChildIds-1707.html

        maybe this can be usefull?

        Dimmy
          follow me on twitter: @dimmy01
          • 12584
          • 208 Posts
          Yes this was what I was after
          <a href ="[~[+id+]~]"> click here</a>

          Hunted though here http://www.modxcms.com/ditto_parameters.html and was unable to find that but guess thats not exclusive to just ditto.

          Does something exist to add to the chunk output on the child page that adds a link back to the parent page, I am sure it exists but I am not sure where on the Docs to find this there just seems to be so many places it could be but I have not found it yet.

          Thanks also for the other solutions, I have book marked this thread as I am sure they will be very useful to me in the near future, these forums amaze me how helpful people here are so thanks so much for the replies.

          Cheers

          Ian
            • 7231
            • 4,205 Posts
            Does something exist to add to the chunk output on the child page that adds a link back to the parent page, I am sure it exists but I am not sure where on the Docs to find this there just seems to be so many places it could be but I have not found it yet.
            This should work:
            <a href ="[~[+parent+]~]"> click here</a>

            Here is a list of the most common Ditto placeholders:
            http://wiki.modxcms.com/index.php/Ditto_Placeholders

            Here are the Document Variables that are available in every document:
            http://www.modxcms.com/document-tvs.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]
              • 12584
              • 208 Posts
              Quote from: dev_cw at Dec 26, 2007, 06:34 AM

              Does something exist to add to the chunk output on the child page that adds a link back to the parent page, I am sure it exists but I am not sure where on the Docs to find this there just seems to be so many places it could be but I have not found it yet.
              This should work:
              <a href ="[~[+parent+]~]"> click here</a>

              Here is a list of the most common Ditto placeholders:
              http://wiki.modxcms.com/index.php/Ditto_Placeholders

              Here are the Document Variables that are available in every document:
              http://www.modxcms.com/document-tvs.html

              Fantastic yes them 2 pages are exactly what I was after.
              Thanks for all help things are working just about as wanted now.

              Cheers

              Ian