Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hello - I have used Couch a few times on basic website projects and absolutely love it. It has been very straightforward to use so far and there is great documentation for someone fairly un-technical such as myself.

However I am now trying to use it for a slightly more complex project and am just trying to figure out how I can approach a particular section that will essentially function as a blog, but each blog entry may potentially be quite long, and feature a variety of content types, in varying order for each entry depending on the clients requirements. Each entry could potentially have multiple paragraphs, multiple images dotted throughout the text, an image gallery (currently set up as a Galleria image gallery within the html/css version of the site), and a video (embedded youtube/vimeo). I am trying to figure out if there is a way to create each of these content types as repeatable regions (since there may be more than one image, more than one video embedded in any one blog entry), but allow those repeatable regions to be reordered on the page? Thanks in advance for any help!
Hi Louise :)

The solution for inputting this kind of content would require a special type of editable region - you can find this being discussed here - viewtopic.php?f=2&t=9013

Unfortunately, we don't have this kind of region at the moment. But, it is certainly on the cards and should make a debut soon.
Hi, thanks for your quick reply.

Although I described this section as functioning as a blog, and these pages being blog entries, the client is actually only going to require adding a maximum of 5 of these pages in the future. Therefore one option is that I don't actually create a blog with cloned pages etc. and just create regular pages that are ready for them to fill with content, and when they are ready for those pages to be 'visible' on the site, they can just link to them from the page that will look like the blog listing page.

Can you think of any solution/workaround by any chance?
OK, in that case it would simply be a case of listing pages from 'multiple' templates.

So suppose you have three different kinds of pages (e.g. video, audio and gallery), create a template for each of them (video.php, audio.php, gallery.php) making them clonable if there would be multiple pages of the same type.

The client can create the pages of each type the normal way.

On the front-end what we do is list the pages from the three templates in a single listing.
This would be exactly like using the regular cms:pages loop but this time with three masterpages.
For this please see viewtopic.php?p=20415#p20415 where the code for it is given.

Does this help? Please let me know.
Thanks.
I think that makes sense. So when you are viewing the site, it will just look like a regular page that has video/text/image galleries etc. but behind the scenes it is actually a listing page where each media type is essentially a seperate masterpage?

And by following the info in the link you provided I should be able to create the multiple master pages required for this function?

And can I then repeat this 5 or so times so that I can create 5 pages that function in this way? Can I re-use the masterpages that I have created for video/gallery etc.?

Sorry if I am being confusing - perhaps it will be more clear to me when I actually begin trying it!

Thanks so much for all your help!
See, the video.php, audio.php, gallery.php etc. templates will be the normal templates we usually use in Couch. Each will have their own unique set of editable regions defined in them.

By declaring them clonable, you'll be able to create multiple pages from each template.
So think of, for example, video.php as a video-only blog and audio.php as an audio only blog.

So if you place the following code anywhere on the site, it will list all 'video' pages -
Code: Select all
<cms:pages masterpage='video.php' limit='10' paginate='1'>
    .. show regions from video template ..
</cms:pages>

.. and the following will list all 'audio' pages -
Code: Select all
<cms:pages masterpage='audio.php' limit='10' paginate='1'>
    .. show regions from audio template ..
</cms:pages>

The code above is listing only pages from a single template.
What you want is a listing that has pages from multiple templates e.g. like this -
Code: Select all
<cms:pages masterpage='video.php, audio.php, gallery.php' limit='10' paginate='1'>
    <cms:if k_template_name='video.php>
        .. show regions from video template ..
    <cms:else_if k_template_name='audio.php>
        .. show regions from audio template ..
    <cms:else_if k_template_name='gallery.php>
        .. show regions from gallery template ..
    </cms:if>
</cms:pages>

Problem is that cms:pages does *not* support multiple templates, so the code above will not work.

However, you can think about the code I pointed to (viewtopic.php?p=20415#p20415) as being the exact equivalent of the code above.

There is no limit on how many templates you can use. If your use-case, for example, requires another template for 'tweets', go ahead and create a clonable template for it. On the code that lists all pages, make sure to add the new template e.g.
Code: Select all
..
WHERE (t.name='video.php' or t.name='audio.php' or t.name='gallery.php' or t.name='tweets.php')
..

Hope that makes things a little more clear.
6 posts Page 1 of 1
cron