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.

Relationships

May 03, 2012 10:14am

Subscribe [2]
  • #1 / May 03, 2012 10:14am

    koogarsox

    27 posts

    Hi folks.

    Wondered if you can help.

    I have a channel for find a seminar which is then displayed based on a category.
    This page > http://www.iconbusinesssolutions.com/find-a-seminar (each entry will be removed once the event has taken place)

    I have now been asked to add the same information to a single entry page. The category info has nothing to do with the single entry page. At the bottom of this page > http://www.iconbusinesssolutions.com/business-adviser/view/tony-field

    So Im trying to work out the best way of doing this to save duplication.

    1: Is relationshiops a way of doing this?
    2: How would I go about it? ANy suggestions and ideas welcomed.

    Thanks in advance.

    Manda
    😉

  • #2 / May 03, 2012 11:09am

    Boyink!

    5011 posts

    I’m a bit fuzzy yet…are the single entries already assigned to the categories that hold the data you want to display?

  • #3 / May 03, 2012 11:18am

    koogarsox

    27 posts

    So am I and thanks for the reply.

    Each seminar has a category assigned to it (at the moment only one on there) and each business adviser is assigned to a category and I have used the same category for them both.

    Does that help things?

  • #4 / May 03, 2012 11:27am

    Boyink!

    5011 posts

    So you have classes and advisers, both assigned to the same category.  And on the single-entry page for the class you now need adviser info?

  • #5 / May 03, 2012 11:30am

    koogarsox

    27 posts

    Yes to the class (Seminar) and advisers having the same category. - I didnt want to have to create two for the same job as it had the sme content.

    Nearly.

    I need the class info on the single-entry adviser page.

  • #6 / May 03, 2012 11:42am

    Boyink!

    5011 posts

    OK - I think we’ve got the situation defined…;)

    Yes, I’d look at using relationships here, and EE’s native relationship abilities will work fine so long as there is a strict 1 advisor to many classes arrangement. If you have classes with >1 advisor then you’ll need to look at the Playa addon.

    Add a relationship field to the channel field group that is assigned to your Classes channel.  Specify your Advisors channel in the field settings.  Each class entry will need to be edited to add an adviser to it.

    Then on your single-entry template for Advisers use the {reverse_related_entries}{/reverse_related_entries} tag pair to display all the classes for that advisor.

    If you wish on the single-entry template for each class you could use the {related_entries}{/related_entries} pair to display advisor info.

  • #7 / May 03, 2012 11:50am

    koogarsox

    27 posts

    OK cool and again thanks!

    We have 6 categories and they have various amounts of advisers within them.

    Only 1 adviser could have a class but that same adviser could have many classes in the future.

    To add an adviser per class entry what would be the best way? At the moment its a text area where you type in thier name. Should I use a drop down? Or?....

    As you can tell I havent used relationships before but I think once I have this ill be able to do them forever more!

    Thanks
    Amanda

  • #8 / May 03, 2012 11:58am

    Boyink!

    5011 posts

    The relationship field will create a drop-down populated with titles from the Advisor channel.

    And to recap:

    1 advisor - many classes, 1 class - 1 advisor = EE native relationship field is fine.

    1 advisor - many classes, 1 class - many advisors = use Playa.

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

ExpressionEngine News!

#eecms, #events, #releases