We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22221
    • 283 Posts
    Thanks a lot Mark grin,

    Exactly what I need. I will test that quickly. ModX is really flexible.
      • 22221
      • 283 Posts
      I’ve made some modifications to the snippet work.

      If docid is not est the snippet use the current document, and if there is no child page, the snippet redirect to the document with docid ID.
      RedirectFirstPageOfFolder:

      $docid = isset($docid) ? $docid : $modx->documentIdentifier;
      $children=$modx->getActiveChildren($docid,'menuindex','ASC');
      if (!$children===false)
      {
      $firstChild = $children[0];
      $firstChildUrl = $modx->makeUrl($firstChild['id']);
      }
      else
      {
      $firstChildUrl = $modx->makeUrl($docid);
      }
      return $firstChildUrl;


      And I profite of this post to thanks and congratulate all the ModX community grin, for the time they spend to help everybody whatever the crazy project they have.
      I will post next days (perhaps week) a tutorial to make a News/Blog site with multi-page elemeent. (French first and English after)
        • 3232
        • 380 Posts
        Quote from: Mark at Apr 07, 2006, 02:20 PM


        1. For all of your multipage articles create a wrapper folder and place each article within it.
        2. When calling the UserComments snippet on each page, do so with a docID equal to the containing folder.
        3. Use getDocument to have the folder display the first child’s document as its content.
        4. Use NewsListing with set to the parent folder of all your news (Don’t turn on multilevel).
        5. Test everything out and make sure it works.


        I am new to Modx and it looks like a very robust tool. I am trying to make a multipage document and followed the directions above (I don’t want comments so i left that part out)

        I don’t understand #3 i dont see any snipplet or anything else for that matter that has a name of ’getDocument’

        Any help would be greatly apreciated
          • 18397
          • 3,250 Posts
          It is posted in a forum thread under the abbreviated name getDoc.
            • 3232
            • 380 Posts
            I’m almost there... now the main container page pulling in the content for the first page of the article... but how does that page know to go to the second item in the folder for page two?
              • 18397
              • 3,250 Posts
              You need to use the PrevNext snippet if I recall to accomplish that.
                • 3232
                • 380 Posts
                Mark,

                It seems that when replacing [+id+] [!SnippetName?docid=`[+id+]`!] in my ditto diplay template that this snippet doesnt actually execute, it just echos "[!SnippetName?docid=`40`!]"

                Could I be doing something wrong?

                Quote from: Mark at Apr 12, 2006, 02:34 PM

                Redirecting is a piece of cake. Try this:

                Quote from: Djamoer at Feb 23, 2006, 08:46 AM

                Here is another quick little snippet that might serve your need as well.

                // Create a new snippet and name it RedirectPage
                // Call it using [!RedirectPage? &docid=`5`!]
                // docid will be the page id number for your redirection
                if(isset($docid) && $docid != $modx->documentIdentifier)
                  $modx->sendRedirect($modx->makeUrl($docid));
                



                To do it more elegantly (without the reload) you could simply alter you NewsListing template so that instead of linking to
                [~[+id+]~]
                you link to a snippet with the following content:

                if(isset($docid) && $docid != $modx->documentIdentifier)
                $id=$modx->documentIdentifier;
                $children=$modx->getActiveChildren($id,'menuindex','ASC');
                if (!$children===false)
                {
                $firstChild = $children[0];
                $firstChildUrl = $modx->makeUrl($firstChild['id']);
                }
                else
                {
                $firstChildUrl = $modx->makeUrl($modx->config['site_start']);
                }
                return $firstChildUrl;
                


                Replacing,
                [~[+id+]~] 
                with
                [!SnippetName?docid=`[+id+]`!]

                  • 33337
                  • 3,975 Posts
                  Are you using this "[!SnippetName?docid=`[+id+]`!]" in Ditto Template?

                  If yes, use it like [[SnippetName?docid=`[+id+]`]].

                  hope this helps.
                    Zaigham R - MODX Professional | Skype | Email | Twitter

                    Digging the interwebs for #MODX gems and bringing it to you. modx.link
                    • 3232
                    • 380 Posts
                    Quote from: zi at Nov 29, 2006, 08:42 PM

                    Are you using this "[!SnippetName?docid=`[+id+]`!]" in Ditto Template?

                    If yes, use it like [[SnippetName?docid=`[+id+]`]].

                    hope this helps.

                    Yes I am using [!..!], when I use [[..]]  the [+id+] doesn’t propigate, it is just left blank.
                      • 33337
                      • 3,975 Posts
                      I am clueless here!... can you PM me the access details so I can personally see it?

                      regards.
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link