0

Each discography entry has a playa field for each disc that contains all the songs that appear on that record, creating a tracklisting. What I'd like to do is create a reverse navigation system, so that people can browse songs and see all releases they appeared on (albums, singles, collections, etc).

It was straightforward to get Low Alphabet to ouput a page containing all songs starting with a letter, now I'd like to have all parent releases listed under them.

I imagine it's something where I'd need to write some custom PHP or use an embed or stash based on research I've been doing.

Relevant template code below - it just outputs a long list of entries (even for X, which has one song that is included on two discography items). Removing channel="discography" doesn't make any impact.

{exp:low_alphabet:entries
        channel="songs"
        alpha_ignore="the"
        numbers="before"
        group_numbers="yes"
        numbers_label="#"
        alpha_filter="{segment_3}"
        orderby="title"
        sort="asc"
        disable="categories|member_data|pagination"
        limit="250"
}
     {if low_alphabet_heading}
         <h2>Songs that start with {low_alphabet_label}</h2>
         <ul>
     {/if}
            <li><a href="{url_title_path="songs"}">{title}</a></li>
            {if no_parents}{/if}
                <ul class="list-nav">
                {exp:playa:parents channel="discography"}
                        <li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
                {/exp:playa:parents}
                </ul>
        {if low_alphabet_footer}
        </ul>
    {/if}
{/exp:low_alphabet:entries}

The following works as expected

    {exp:channel:entries channel="lyrics" limit="50"}

         <ul>
            <li><a href="{url_title_path="songs"}">{title}</a></li>
                <ul class="list-nav">
                    {exp:playa:parents}
                    <li><a href="{path={channel_short_name}/{url_title}}">{title}</a></li>
                    {/exp:playa:parents}
                </ul>
        </ul>

    {/exp:channel:entries}
1

That code should work but you might want to use the var_prefix parameter to avoid variable name conflicts.

Also, because Low Alphabet is a plugin and EE's quirky template parser, you'll need to add parse="inward" to the opening low_alphabet:entries tag if you're using other tags inside it (as per the docs).

5
  • at this point the playa bit just outputs all songs associated with a discography entry - even for X which only has one song entry, it spits out the latest x discography entries. It's not targeting the "this" entry contained by the loop, but the channel itself as far as I can tell. – eru May 11 '14 at 6:20
  • Try adding entry_id="{entry_id}" to the playa:parents tag. But this is a Playa issue more than a LA one, really. – Low May 12 '14 at 7:56
  • Adding entry_id="{entry_id}" makes it so there are no results. I'll give pixel and tonic a ping. – eru May 13 '14 at 23:36
  • It does seem to be a LA issue. I'm honestly better off just running a SQL query based on url_segment and manually creating a menu embed if I can get the playa relationships working correctly sticking with a standard channel entries tag. – eru May 14 '14 at 0:16
  • Try adding parse="inward" to the opening LA tag. – Low May 14 '14 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.