We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    I need to preview a number of the page i am on*.
    (i have a thumbnail carousel where i can decide, based on a number, to start the carousel)
    I can't use the id or menuindex.

    * Lets say the resource tree looks like:

    Food
    - tomato
    - cheese
    - apple

    Is there a "easy" way to show/output a number on the page i am?
    Where i like to have tomato : 1 , cheese: 2 , apple: 3


    Wayfinder? Ditto? Custom?

    [ed. note: fourroses666 last edited this post 14 years, 3 months ago.]
      Evolution user, I like the back-end speed and simplicity smiley
      • 9995
      • 1,613 Posts
      *BUMP*

      I did manage to count total pages:

      [ ! counting ? & parent = `2` ! ]

      <?php
      $parent = isset($parent) ? (integer)$parent : $modx->documentObject['id'];
      $child_count = $modx->db->getRecordCount( $modx->db->select( 'id',$modx->getFullTableName('site_content'), 'parent="'.$parent.'" AND published="1"' ) );
       
      $output = $child_count !='' ? $child_count : '';
      return $output;
      ?>
      [ed. note: fourroses666 last edited this post 14 years, 3 months ago.]
        Evolution user, I like the back-end speed and simplicity smiley
        • 16610
        • 634 Posts
        Ditto:

        With [+ditto_iteration+] placeholder.

        Iteration starts from zero, so actual page number would be then:

        [+ditto_iteration:math=`?+1`+]
          Mikko Lammi, Owner at Maagit
          • 9995
          • 1,613 Posts
          Thanks!

          I had to have current doc number and not all numbers so i used ditto tplCurrentDocument and tpl [ + description + ] which isn't filled so i get blank result.

          [ed. note: fourroses666 last edited this post 14 years, 3 months ago.]
            Evolution user, I like the back-end speed and simplicity smiley