Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Thank you for this forum.

I am currently adopting my own theme with couch and i am experiencing a challenge. I have a portfolio page. I would like to display a "zebra" output of images, videos and posts. Images are handled by gallery.php, videos by media.php and posts by posts.php. i want to display the content of this pages in one page - portfolio.php and display them using isotope/masonry. I do not want to display in sections but in some sort of "zebra" format thus: image, video, post, image, video, post, e.t.c

Please help me or guide me on how i can do this using couch tag - zebra or any other way. Thanks for your help.
That's a tough one, Jeph :)

One way we could pull it off is as follows -
choose the template that has (and will have) the largest number of posts of the three types that you have (I'll assume it is 'posts.php').
Code: Select all
<cms:pages masterpage='posts.php' limit='10' paginate='1' startcount='0'>

    <!-- post -->
    <cms:show k_page_name /><br />
    
    <!-- image -->
    <cms:pages masterpage='gallery.php' limit='1' offset=k_absolute_count>
        <cms:show k_page_name /><br />
    </cms:pages>
    
    <!-- video -->
    <cms:pages masterpage='media.php' limit='1' offset=k_absolute_count>
        <cms:show k_page_name /><br />
    </cms:pages>
    
    
    <cms:paginator />
    
</cms:pages>

In the code above, we use cms:pages to list cloned pages of posts.php the usual way. Within the loop, however, we use nested cms:pages to fetch just one post of the other two templates. So, effectively, at each iteration of the outermost cms:pages we fetch three different pages.

The most important part of the code above is offset=k_absolute_count.
k_absolute_count starts from 0 and increases as the posts.php pages get listed. We use this to skip those many posts from the inner loops and get only one page for each.

Hope this helps.
Do let us know. Thanks.
2 posts Page 1 of 1
cron