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.

Behind the Curtain Part IV

August 20, 2007 12:16pm

Subscribe [13]
  • #16 / Aug 22, 2007 10:36am

    jschutt

    452 posts

    Sounds great!  Thanks so much for the direction.

    I am going to work on this for awhile and I will let you know how it goes.

  • #17 / Aug 22, 2007 7:25pm

    jschutt

    452 posts

    Derek,

    On your features page, how would you have accomplished grouping some of the different features within your categories?

    Maybe this will be clearer - I have some speakers who speak at multiple events.  I have it already set up to create a relationship from the mp3’s to the speaker.  I also have it set up to display the speaker, a picture, a bio, as well as any of the mp3’s that are related to him.  My question is this - Is there anyway to group mp3’s from each event for a speaker that has multiple events to his credit?

    I have tried using the following:

    {exp:weblog:entries weblog="speaker_info" limit="15" sort="desc"}
        <div class="descriptionlist">
          <div class="inlineImage left">{speaker_image}</div>
          <h3>{title}</h3>
    <p>      <br />
    {if speaker_bio == ""} <i>No Bio Info Available</i>{/if}{speaker_bio}<br />
     </p>
    
    <p>{exp:weblog:category_heading}<br />
    <h1>{category_name}</h1><br />
    {/exp:weblog:category_heading} </p>
    
    <p><ul><br />
    {reverse_related_entries sort="desc" orderby="date" sort="asc"}<br />
    <li><a href="http://{mp3_url}" target="_blank" rel="noopener">{title} {if subtitle !=""}—{/if} {subtitle}</a></li><br />
    {/reverse_related_entries}<br />
    </ul></p>
    
    <p><hr class="clearboth" >  <br />
      </div></p>
    
    <p>{/exp:weblog:entries}

    But since the {exp:weblog:category_heading} is not inside of the {reverse_related_entries}, I get nothing.  If I put it inside of the {exp:weblog:category_heading}, I get nothing either 😠

    Any help would be appreciated!

  • #18 / Aug 22, 2007 7:29pm

    Derek Jones

    7561 posts

    That tag’s not meant to be nested (and is also intended only for category pages).  What you are looking for is the category variable pair of the weblog entries tag (and by extension the reverse related entries tag pair).

  • #19 / Aug 22, 2007 7:32pm

    jschutt

    452 posts

    I had tried that.  I think…

    But when I placed that inside of the {reverse_related_entries} tag, it loops through each of the mp3 entries.  What I am trying to accomplish is one header that lists the event category for any applicable mp3’s.

  • #20 / Aug 22, 2007 11:20pm

    Derek Jones

    7561 posts

    Am I correct that you have an MP3 weblog with a relationship field for the speaker, and you are also categorizing the MP3 weblog entries?  Can you give me a non-code example of the output you are desiring?

  • #21 / Aug 22, 2007 11:29pm

    jschutt

    452 posts

    Am I correct that you have an MP3 weblog with a relationship field for the speaker, and you are also categorizing the MP3 weblog entries?

    That is exactly what I am doing. 

    This is what I am trying to achieve:

    Dr. Larry Andersen
    Larry is a master of illustrations…more bio stuff here…and he lives in WI.

    Family Camp 1(this is one of the event categories)
        Session 1 (these are categorized by event and related to the speaker)
        Session 2
        Session 3
        Session 4

    Family Camp 3
        Session 1
        Session 2
        Session 3
        Session 4


    Is this clear or should I give some more details?

    Thanks so much for your assistance!

  • #22 / Aug 22, 2007 11:39pm

    Derek Jones

    7561 posts

    Ok, so what you have here is category archives output, but are wanting it within the reverse relationship for each entry.  You’re going to need either some PHP or be willing to use some embedded templates and some increased overhead.  The whole bit about displaying entries sorted under category headings is the “expensive” part I speak about in the article, and doing this inside of each entry only compounds that.  You’re no longer doing one or the other, but both.  I’d recommend taking what you’ve gotten so far, and heading over to the How To forums with it to seek some assistance on different ways you could build that type of output.

  • #23 / Aug 22, 2007 11:41pm

    jschutt

    452 posts

    I was kind of thinking it might require some custom stuff :roll:

    Thanks for all of the assistance.  I’ll keep trying to figure something out!

  • #24 / Aug 24, 2007 6:00am

    Ronny

    83 posts

    Just wanted to say that relationships and reverse relationships are the reason why I bought EE for my personal site. Now I was able to transform my site from a structured article-site to a full-size imdb.com-like website and lifted EE from a blogging tool to something even more powerful than a regular CMS. I just love those relationships!

    (I must say, the database size looks huge if you use a bunch of (reverse)relationships, but if you optimize your databases once in a while you solve that problem as well.)

  • #25 / Aug 28, 2007 5:21am

    Jan_Huygens

    106 posts

    Hi

    Another good & useful article - thanks. How I wish reverse_relationships had been available in EEv1.4!

    Some thing that is a bit counter-intuitive on casual reading is the child-parent terminology.  Thus in your example, a ‘feature’ is the parent to a ‘feature_category’ and 1 child could have 10, 20 or even 10000 parents!!
     
    <old man voice> I guess I’m just not used to this modern era. In my day, a child had one or two parents and that was it.</old man voice>


    BTW what happens if the child is pointed to by related entry fields in two different weblogs?  Since there is no id in the reverse_related, how would do you select the weblog you want to use? 

    But perhaps this is a rather hypothetical question, that is not likely to occur in practice?

    Jan

  • #26 / Aug 28, 2007 8:25am

    Derek Jones

    7561 posts

    You would supply a weblog= parameter to the {reverse_related_entries} tag pair; if you do not, then it will show all entries from all weblogs that have been related to said entry.

  • #27 / Aug 28, 2007 8:32am

    Jan_Huygens

    106 posts

    Hah - of course.

    There’s nothing like reading the docs!

    Jan

  • #28 / Aug 29, 2007 3:59pm

    tpayton

    172 posts

    Back to the original topic, I am buidling something very similiar on a site right now, however what can be done to hide the headings (or in this case feature categories) if there are no reverse related entries?

  • #29 / Aug 29, 2007 5:09pm

    Derek Jones

    7561 posts

    The information from the weblog entries tag cannot natively be hidden or acted on based on whether the entry has been related to other entries.  Some PHP either in the template, or setup as a plugin could handle that though; I’d step over to the How To forum and ask for assistance if your comfortability with PHP is low.

  • #30 / Oct 08, 2007 11:29pm

    stinhambo

    1268 posts

    I just came back to this article as I knew it would come in handy for a future site and I think it has done.

    The count variable is an awesome find! It took me a little while to see what was going on but I think it’s one for the assets drawer.

    One thing I really like are practical examples of EE features as I can see them applied to real life situations. Of course it would be wonderful to see all the docs in this way but thank you Derek for taking the time to show us how the developers think when using EE.

    I’m very much looking forward to the next installment!

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

ExpressionEngine News!

#eecms, #events, #releases