ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Help about reverse-entries

July 12, 2012 12:38am

Subscribe [3]
  • #1 / Jul 12, 2012 12:38am

    carlosq

    9 posts

    Hi, Im a EE newbie….

    I want to have a Master / Detail page with EE, when a user click on an Album it should show the album title and its paginated photos

    So I built two channels: Albums and Photos, Photos have a relationship field to Albums.
    My problem comes because I dont know how to filter photos by albums, I see that search:field can’t help here…So I decided to use reverse_related_entries (is this the only way?)

    This is what I’ve done so far…

    {exp:channel:entries channel="albums" paginate="top"}
    
      <h2><a href="http://{path=albums/{url_title}}">{title}</a></h2>
    
    <p>  {reverse_related_entries sort="desc" orderby="date" }<br />
        {if no_reverse_related_entries}<br />
          <div>The Album is Empty</div><br />
        {/if}<br />
        <div>{title}</div><br />
        ...<br />
      {/reverse_related_entries}</p>
    
    <p>{/exp:channel:entries}

    The problem I have is reverse_related_entries don’t support pagination and other stuff like that, and for sure I want those photos paginated…

    Thanks in advance

  • #2 / Jul 12, 2012 9:42am

    Boyink!

    5011 posts

    Yes, reverse_related_entries would be your approach here.

    For filtered & paginated results you might have to use EE categories instead (one category being an album).  This would also allow one photo to be assigned into multiple albums.

    The other approach would be to look at Playa from Pixel & Tonic - which would again use relationships but looks to accomodate paginated results:
    http://pixelandtonic.com/playa/docs/templates

  • #3 / Jul 12, 2012 10:14am

    John St-Amand

    865 posts

    One additional note on Mike’s suggestion of looking at Playa - in addition to supporting pagination, it would also give you the ability - whether you need it or not, remains to be seen - to have a photo appear in more than one gallery since playa is a one to many relationship fieldtype, whereas the native EE relationship fieldtype is one to one.

    Hope that helps.

  • #4 / Jul 12, 2012 10:37am

    carlosq

    9 posts

    Thanks Boyink, I think I cannot use categories, because Albums are created and owned by members, they might have other custom fields also. I’ll Take a look at Playa right now, and John suggestion is valid and clear, my relationship is actually one-to-many, then Playa might help.

    Thans you both guys, really aprecciated.

  • #5 / Jul 12, 2012 10:45am

    Boyink!

    5011 posts

    playa is a one to many relationship fieldtype, whereas the native EE relationship fieldtype is one to one.

    I’d disagree with this (respectfully, as I’m sure John knows).

    The native EE relationship field type is a 1:many. This is what allows the reverse_related_entries tag to return many children for one parent.  It’s just that you setup and define the relationship from the side of the child which feels opposite if what’s expected.

    Playa actually is a Many to Many tool.  Each parent can have multiple children and each child can belong to multiple parents.

    Back to categories - you can allow users to create categories (but would have to allow CP access), and you can add custom fields to categories (albeit with a more limited vocabulary of fieldtypes than in Channels).

    Playa is an excellent (and almost indispensable) add-on, but I just like to make sure people understand where EE starts and ends and where Playa picks up from there.

     

  • #6 / Jul 12, 2012 10:56am

    carlosq

    9 posts

    The native EE relationship field type is a 1:many. This is what allows the reverse_related_entries tag to return many children for one parent.

    Thanks, I understand now; EE support one-to-man, now back to my issue, let me ask, How can I show in a template the album and it’s paginated photo children, I’d been trying several ways unsuccessfully. In other aproachs I would send the album ID in the querystring, select both album and photos with one or two queries and display results, very basic.

    I also know that my starting experience with EE is the issue, but help is really needed, we bought EE to save some programming time, now it’s taking longer that I thougt. Thanks for your help

  • #7 / Jul 12, 2012 11:01am

    Boyink!

    5011 posts

    As referenced earlier - you’ll need Playa.

    Or possibly a custom query - EE has a query module you can install and use, providing a SQL statement. The query module has pagination available in its results.

  • #8 / Jul 12, 2012 11:04am

    carlosq

    9 posts

    Thanks Mike!!! We’ll get it asap, love to custom query stuff, but I have deadline is so close.
    Also great work you’re doing with trainee, your websites looks great.

  • #9 / Jul 12, 2012 11:11am

    Boyink!

    5011 posts

    Thanks - appreciate the comments!  The design is nearly 4 years old so it speaks well of the designer I hired for it..😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases