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.

Sorting out entries with different elements in a single channel

March 05, 2014 3:15pm

Subscribe [4]
  • #1 / Mar 05, 2014 3:15pm

    mvcreative

    12 posts

    Hello everyone,
    Not even sure how to summarize the question… so please, bare with me for a second:

    We need to display the names of board members.  The fields are position, photo, company.

    In the actual “board” page we need to display first the main Officers (with order by President, VicePresident, etc) and after that the Board Members (order by last name).

    The way I’m thinking to do this is by creating a Channel called Officers with custom order and another Channel called “Board Members” where we have last name as part of the fields. and in the page, will use two channel entries to display both channels.

    The question is:
    Can this be accomplished with a single Channel, where the Officers/Member are either fields or category and use a single {exp:channel:entries} block?  How can be divided to display first Officers with custom order, and later the other guys?

    Something like:

    {exp:channel:entries channel="board" }
    Officers
    Name 1 - President
    Name 2 - Vice President
    Name 3 - Some other positions

    Board Members
    LastName1
    LastName2
    LastName3
    etc…
    {/exp:channel:entries}

    Hope that the question makes sense.

    Thanks for your time

  • #2 / Mar 06, 2014 3:12am

    ahmad saad

    364 posts

    Hi ,

    a quick workaround is to use an order field give the officers entries the order u want 1, 2, 3 .... then make the board members with same higher order like 100

    and use

    orderby="order_field|lastname" sort="asc"

    in ur channel:entries


    and if u want to use categories and not enter an order for every board members u can use

    {exp:channel:category_archive channel="board"}
        {categories}
                <h3>{category_name}</h3>
    <p>                                                     <br />
            {exp:channel:entries channel="board" category="{category_id}" orderby="order_field|lastname" sort="asc"}<br />
                <a href="http://{title_permalink=PATH}">{title}</a><br />
            {/exp:channel:entries}</p>
    
    <p>    {/categories}<br />
    {/exp:channel:category_archive}

    offcours u must add Officers and Board Members categories and give them a custom order to show officers as first category


    Regard’s.

  • #3 / Mar 06, 2014 6:48am

    Rob Allen

    3114 posts

    You could also use a custom select/radio field with specific “type” names, eg Staff, Board, Officers and run the whole list from one channel. That way, if a staff member is promoted to a board member you only have to change one field value.

    You’d output the entries loop using the search: parameter…

    <h2>Board members</h2>
    <p>{exp:channel:entries channel=“your_channel” search:your_type_field="Board" }<br />
    {title}<br />
    {/exp:channel:entries}</p>
    
    <h2>Officers</h2>
    <p>{exp:channel:entries channel=“your_channel” search:your_type_field="Officers" }<br />
    {title}<br />
    {/exp:channel:entries}

     

  • #4 / Mar 06, 2014 8:25am

    Boyink!

    5011 posts

    Or you could use relationships…one channel of Positions with entries of Board Members/Officers etc and another channel of People. Use a relationship field in the Positions channel to select from the People channel.

    So many options!

    😉

  • #5 / Mar 06, 2014 3:38pm

    mvcreative

    12 posts

    Hey Thanks a lot guys!
    Rob’s idea and it works fine.

    As a personal thing, will like to try Ahmad, and Boyink!‘s because I haven’t done a lot using relationships or using categories for entries control… still, need to get my head around relationships…

    So for now, the client will have what he needs but there is one ‘issue’ that has been bothering me about how i have been setting up fields in previous projects:

    The member’s name: John Smith that will need to be broken down into first name, last name for the order thing, what is the best practice for the Title field?

    Right now, my entries are like this:
    Title: John Smith (because I will need the URL for ‘read more about this guy’-link)
    First Name: John
    Last Name: Smith

    What bothers me is that I’m duplicating info and leaving the door open for typos when the user needs to add new entries.  It could be considered that Title is just for the name, but that affects how the URL will work…  So, what’s the best approach for something like this?

    Thanks again!
    PS
    Yes Boyink!, so many options… the challenge is to find the best or more efficient ones… so far, just discovered stash and template partials workflow (remember I’m a newbie with EE)... and wow.  Happy Marco here.

  • #6 / Mar 06, 2014 3:44pm

    Boyink!

    5011 posts

    If you’re a newbie I’d recommend holding off on Stash and Partials.  Figure out how EE wants to work natively first (especially with 2.8’s new features).

    I’m always frustrated with how quickly people want to recommend all the advanced stuff to newcomers to EE. I see a lot of cases where add-ons and advanced solutions are used where simpler approaches are possible.

  • #7 / Mar 06, 2014 3:55pm

    Boyink!

    5011 posts

    Also - there’s an add-on called Title Master that will help solve your name issue. You can store the names as separate fields and then have Title Master create the Title/URL title from them.

  • #8 / Mar 06, 2014 4:10pm

    mvcreative

    12 posts

    You are right Boyink! they are a lot of things that have to be understood about EE.

    What got me into stash/partials was that I was getting tired of duplicating layout code and using embeds/snippets/Globalvariables (and i read that embed templates could affect performance). 

    So far, this site i’m working on has been going smooth and (crossing fingers) stash is doing what I was expecting to do without surprises.  Combining embeds/snippets/Global/ variables for a couple of layouts used across different pages but It’s making sense what and where to use certain elements. 

    I installed 2.8 (local server too) and is worth to explore the new added features but I always like to wait for new versions until some glitches are found or resolved.  But already gathering learning resources and got one of the EE books and training from Ryan Irelan… some elements too basic, but is going ok.

    Just visited Title Master’s page and it seems that there are some issues and not being updated.

    Thanks!

  • #9 / Mar 06, 2014 4:29pm

    Boyink!

    5011 posts

    (and i read that embed templates could affect performance). 

    My curmudgeonly view is that alot of developers hear that and repeat it without doing any actual tests for themselves. I’ve lost track of how many blog posts I’ve read about the “template parser overhead” that have no performance data to back it up.

    Take a look at:https://github.com/andrewfairlie/stash-layouts for some testing with actual numbers attached.

    Also consider there are more facets to ‘performance’ than just how fast pages load. Every add-on you install is one more potential upgrade roadblock between you and the latest EE version, opens the possibilities for less than great code, and makes getting any support that much harder.  Evaluating performance needs to consider the performance of the site, you as the developer, who ever is going to maintain the content, and also the business aspect of future maintenance and upgrades.

    Sad to hear about title master, but actually proves the point.

  • #10 / Mar 06, 2014 5:07pm

    mvcreative

    12 posts

    You are right.  That’s why it’s important to ask around different points of view or as you say search for more actual data…

    Thanks for sharing the link! I’m glad that they just posted it. 

  • #11 / Mar 06, 2014 5:10pm

    ahmad saad

    364 posts

    Hi mvcreative,

    u can use http://www.eec.ms/add-ons/mx-title-control

    for ur title problem.

    I hope it will help u,

    Regard’s.

  • #12 / Mar 06, 2014 7:03pm

    mvcreative

    12 posts

    Thanks Ahmad, will take a look but will follow Boyink!‘s advice of exploring options with EE alone…


    Thanks everyone!

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

ExpressionEngine News!

#eecms, #events, #releases