We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    I would remove the HTML comments.

    Two suggestions:
    - change line in the snippet to:
    $dir = "assets/templates/myfolder_v1/carousel/";
    - call it uncached while testing:
    [[!carousel]] (or [!carousel!] for Evo)
      • 12793
      • 293 Posts
      :(((

      I’ve used

      [[!carousel]] (on revo)

      (without <!-- -->)

      in my snippet I’ve:

      $dir = "assets/templates/temp_v1/carousel/";

      I show an empty page
        • 33968
        • 863 Posts
        Can you paste your full snippet here - not just that one line?

        And... ’assets/templates/temp_v1/carousel/’ is definitely where your images are?
          • 12793
          • 293 Posts
          This is my snippet

          <?php
          $dir = "assets/templates/temp_v1/carousel/";
          $output = ’’;
          if (is_dir($dir)) {
          if ($dh = opendir($dir)) {
          while (($file = readdir($dh)) !== false) {
          if(filetype($dir.$file) == ’file’) && $file != ’.’ && $file != ’..’)
          $info = pathinfo($file);
          $file_name = basename($file,’.’.$info[’extension’]);
          $output .= ’<img title="’.$file_name.’" alt="" src="’.$dir.$file’" />’;
          }
          closedir($dh);
          }
          }
          return $output;




          all my images are in

          ’assets/templates/temp_v1/carousel/’
            • 3109 ☆ A M B ☆
            • 894 Posts
            Umm why not just use the gallery plugin and customize it with the gallery type you want to use?

            I created this gallery from scratch with some jquery although its not as fancy as probably what you want but the process is very simple.

            Hmmm I think this can be my first tutorial smiley
              Benjamin Marte
              Interactive Media Developer
              Follow Me on Twitter | Visit my site | Learn MODX
              • 33968
              • 863 Posts
              Try this (syntax error in your code):
              <?php
              $dir = "assets/templates/temp_v1/carousel/";
              $output = '';
              if (is_dir($dir)) {
                  if ($dh = opendir($dir)) {
                      while (($file = readdir($dh)) !== false) {
                          if((filetype($dir.$file) == 'file') && ($file != '.') && ($file != '..')) {
                              $info = pathinfo($file);
                              $file_name =  basename($file,'.'.$info['extension']);
                              $output .= '<img title="'.$file_name.'" alt="" src="'.$dir.$file.'" />';
                          }
                      }
                      closedir($dh);
                  }
              }
              return $output;
              


              @ben - he wanted to pull images from a folder dynamically rather than use the manager, that’s what the snippet above does. However plenty of people are interested in putting a gallery together but not sure how to start. Have a crack at writing a tute, it would definitely be appreciated!
                • 12793
                • 293 Posts
                Now I show 2 images....

                [[!carousel]]

                Not 1 image but 2 images
                in the same area

                Thanks
                  • 33968
                  • 863 Posts
                  It should display any images you have in that folder. So if two images, two displayed on screen.

                  I think you wanted to display them as a carousel, you need to set that up correctly so it will only show one image at a time. Which one are you trying to implement?
                    • 1169
                    • 312 Posts
                    You now need to apply your jquery script you chose to now use the list you have created.
                      DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
                      • 12793
                      • 293 Posts
                      I like this carousel style

                      http://nivo.dev7studios.com/demos/