Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hello there!

I am trying to implement Swipebox slider with CouchCMS gallery.
I was about to do it with PHP but wanted Couch syntax ago.

Basically what I need is get the Gallery (folder) and contents of a folder.
Two foreachs may solve my issue:)


Code: Select all
<!-- Gallery 1 -->
<a  id="gallery-1" rel="gallery-1" href="big/image1.jpg" class="swipebox">
   
</a>
<a rel="gallery-1" href="big/image2.jpg" class="swipebox">
   <img src="small/image2.jpg" alt="image">
</a>
<!-- Gallery 2 -->
<a rel="gallery-2" href="big/image3.jpg" class="swipebox">
   <img src="small/image3.jpg" alt="image">
</a>
<a rel="gallery-2" href="big/image4.jpg" class="swipebox">
   <img src="small/image4.jpg" alt="image">
</a>


And initiate the slider with this code (which I will generate dynamically as well)
Code: Select all
$( '#gallery-1' ).click( function( e ) {
   e.preventDefault();
   $.swipebox( [
      { href:'big/image1.jpg', title:'My Caption' },
      { href:'big/image2.jpg', title:'My Second Caption' }
   ] );
} );
Hello,

Using two loops to output the two blocks of code you have is certainly a solution.
Another would be to use only a single loop and use <cms:capture> within the same loop to generate and buffer the second block simultaneously.
The first method might seem easier to you so let us choose that.
.
In Couch, as I am sure you know, the cms:pages, cms:folders kind of tags work like the foreach loop you mentioned.

Assuming you can generate one of the two blocks your design requires using, e.g., cms:pages loop, you can then repeat the same cms:pages loop to generate the second block. No problem in using the loop multiple times.

If you have trouble doing it, please try implementing at least the first loop (to output the multiple galleries with images).
Please post your working code once you are done and I'd be glad to help you in implementing the second loop.
2 posts Page 1 of 1
cron