0

I've got a music site where I am displaying a list of recordings in a "recordings" channel on one page with some info about each one; I'm not using a single-entry page for these. For each recording, I'm using <a name="{entry_id}"></a> so I can link to the entry.

I have a separate "press clips" channel, with a separate category for each recording, so that it's easy to display all the reviews for a specific recording on a page.

What I want to do is link the category image from the "press clips" channel to the recordings page listing for that particular recording, so I'm looking for a link like <a href="{site_url}music/recordings#{entry_id}. But I can't figure the way to get the {entry_id} automatically.

Should I be using a relationship field (something I'm not so familiar with using) to link the recording with the press clips? Or is there some simple way to do this?

2

Are you on EE 2.8.1?

It would probably be easiest to use a relationship field in the "press clips" channel instead of creating a separate category for each recording. You can then easily get the entry_id of the related recording by doing something like the following:

{exp:channel:entries channel="press clips"}

{related_recording}
     <a href="{site_url}music/recordings#{related_recording:entry_id}>{title}</a>
{/related_recording}

{/exp:channel:entries}

One thing to be careful of is the status of the related entry. If the status of the related entry is anything other than "open", you need to specify it in the tag pair. Also, the status in the related entry tag pair parameter is case sensitive, which is different behavior than the regular channel:entries tag pair.

So for example, if the related_recording has a status of "NEW Album" you would need to have your code look like this:

{exp:channel:entries channel="press clips"}

{related_recording status="NEW Album"}
     <a href="{site_url}music/recordings#{related_recording:entry_id}>{title}</a>
{/related_recording}

{/exp:channel:entries}

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.