Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
hello - I'm back on the forum after a long gap ... I can see that lots of good things have been happening to Couch in my absence! I am planning a site for a music company and am wondering how best to handle the following:

The client will set up albums and each album will consist of a number of tracks, each with an audio clip. That seems fairly straightforward and I was thinking of using a clonable template for each album and repeatable regions for the tracks. BUT another requirement is for a track search/filtering page on which all tracks can be filtered by genre e.g. rock, blues. A track may be associated with more than one genre. I though of using relations, but I don't think that is compatible with repeatable regions. I wonder if someone could point me in the right direction?

Another thought that occurs is that on this track filtering page there could be a very large number of results, especially unfiltered ... should I be using infinite scrolling as described here? viewtopic.php?f=8&t=8963&hilit=ajax+loading

Thanks!
Hello @potato.
Welcome back :)

Replying to your query -
you are correct about repeatable regions not supporting relations so we can count them out.

I think there could be two solutions we can explore -
1. Create the tracks also as cloned pages (i.e. use a separate template) and relate them to the albums in a many-to-one manner (a track could belong to only one album but the album may have many tracks).

Additionally, to make it easier to mange the tracks from the album edit screen, use the type='reverse_relation' method described in the following thread - viewtopic.php?f=8&t=8559

2. The second solution could be to use 'mosaic' (viewtopic.php?f=5&t=11105) with a single 'tile' to hold the track. Tiles can be treated, for practical purposes, as normal templates (do a cms:dump while listing a tile and you'll see the 'template' name it uses internally). So, I think, they should be amenable to filtering just like regular pages.

Hope the reply helps. Do let me know if something is unclear.
... thanks for your reply @KK and HNY to everyone.

I am interested in creating the album tracks as cloned pages as you suggest but I'm not clear how this will work in terms of the Admin Panel and ease of use for the client. The client will expect to log in, create a new Album and within that new Album set up a number of tracks - all on the one screen. In your reply you said

Additionally, to make it easier to mange the tracks from the album edit screen, use the type='reverse_relation' method described in the following thread - viewtopic.php?f=8&t=8559
I have looked at the topic you mention and can't quite see how I would achieve the streamlined single input screen for an album and tracks with this method. Do you mind expanding a little more please?
@potato, you'll have to try out the technique first-hand to evaluate the user-experience.
I'll lay out the steps here to make it a bit easier for you (it is all the same as described in the original gallery thread I mentioned earlier but now tailored for normal cloned pages) -

1. Create a clonable template for 'tracks' -
Code: Select all
<?php require_once("couch/cms.php"); ?>
<cms:template clonable='1'>

    <cms:editable
        type='relation'
        name='tracks_album'
        masterpage='albums.php'
        has='one'
        no_gui='1'
        label='-'
    />

</cms:template>

<h1>Tracks</h1>

<?php COUCH::invoke(); ?>

Register it by visiting as super-admin.
Make sure to unpublish the pesky 'default-page' once registered.

Next create a clonable template for 'albums' -
Code: Select all
<?php require_once("couch/cms.php"); ?>
<cms:template clonable='1'>

    <cms:editable
        type='reverse_relation'
        name='album_tracks'
        masterpage='tracks.php'
        field='tracks_album'
        anchor_text='View/Add Tracks'
        label='Tracks'
    />

</cms:template>

<h1>Albums</h1>

<?php COUCH::invoke(); ?>

Again, register it and unpublish the default-page.

Now try creating a new 'album' page.
You'll find the following link in it pointing to its child tracks (the link will become active once you save the new album page) -
album.png
album.png (9.74 KiB) Viewed 1302 times

Clicking on that link will take you to the tracks template but you'll see here that it clearly shows that the listed tracks are related to a certain album page -
track.png
track.png (8.31 KiB) Viewed 1302 times

Add new track cloned pages the usual way but they'll all automatically get associated with the album page that was clicked to get here -
track2.png
track2.png (10.93 KiB) Viewed 1302 times

Try creating a few albums and adding tracks to each.
You'll see how it works.

Let me know if it'd do for your use-case.
ah - a picture speaks a thousand words - thanks so much - I understand how the relationship looks to the client in the Admin Panel and I think that would work very well
5 posts Page 1 of 1