We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33070
    • 57 Posts
    hi all i want to to create navigation with limit like page id 78 to 90 i am setting startid=78 and limit 90 its not working any help
      • 33070
      • 57 Posts
      no answer/ help still figuring out how i can do this please help
        • 7231
        • 4,205 Posts
        You will need a custom snippet to get the sequence of docs for the menu. Are all the docs under the same parent? Are the document IDs sequential? If so then you can use php to generate a list of ID’s based on the range and then use the output as the &documents parameter in Ditto:

        [!Ditto? &documents=`[[SnippetToGetSequence? &start=`78` &end=`90`]]` ....rest of ditto call...!]


        In php use the range() function to create an array with all the numbers in the range, then use a foreach() loop to output the range as a comma delimited list
          [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]
          • 33070
          • 57 Posts
          Hi dev_cw Thanks for help i really appreciate, i am using wayfinder for my navigation wayfinder provider startid and limit paramater i can’t get result with this ?
            • 7231
            • 4,205 Posts
            You could use the same principal from above with wayfinder:

            [!Wayfinder &startId=`put parent ID here` &includeDocs=`[[SnippetToGetSequence? &start=`78` &end=`90`]]`!]


            To use the limit parameter 78 would need to be the first child and the limit would be the difference &limit=`12` to only show 12 documents. This will only work if 78 is the first child.
              [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]
              • 7231
              • 4,205 Posts
              Here is a simple snippet to generate the list from a start/end number.
              <?php
              
              $start = (isset($start) && is_numeric($start)) ? $start : '';
              $end = (isset($end) && is_numeric($end)) ? $end : '';
              
              $output = '';
              
              if(($start != '') && ($end != '')){
                  foreach(range($start, $end) as $num){
                      $output .= $num.',';
                  }
                  $output = rtrim($output, ',');
              }
              
              return $output;
              ?>


              Use it like [[range? &start=`78` &end=`90`]]. The output willl be:

              78,79,80,81,82,83,84,85,86,87,88,89,90
                [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]