Follow up: Using jCarousel with MODx
Thursday, May 15th, 2008
This is a follow up post from “Using jCarousel with MODx“. Thanks to BobRay and smashingred over in the MODx forums for their help on this.
What we have done is taken a site utilizing a custom MODx snippet, coupled with the jQuery, jCarousel photo gallery script and created a photo gallery that should require a minimal skill level to manage.
The Challenge
As mentioned in my previous post I was able to take MODx and jCarousel and produce an easy to use photo gallery that only needed images and an unordered list to populate the script content. Once the initial phase of the site build was complete, I realized that by creating a MODx snippet we could dynamically create this unordered list by only placing and removing images in a specific directory. In my opinion this would further simplify the process for adding and removing images from the gallery.
The Solution
A MODx snippet was created (Here is the snippet code.). In order to replicate this just create a snippet in MODx named ‘directory’ and then call it in where you want the gallery placed as [!directory? &Location=`yourdirectory`!]. Now the assumption here is that you are working with images inside of the ‘assets/images’ directory of Modx. Of course the jCarousel code is necessary as well. You can see the gallery snippet in action here.
NOTE: There is a slightly different jCarousel version for placement of multiple carousels on a single page.
More Possibilities
We are looking at the possibility of using this for more than just image galleries. This would likely require more extensive work with the snippet and would include the use of another snippet variable to denote the type and location of the document directory in question.



































