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.

Entries appear based on 'selection'.

December 21, 2011 9:44am

Subscribe [2]
  • #1 / Dec 21, 2011 9:44am

    ZEDG

    32 posts

    HI
    I have set up an intranet home page that shows a list of all staff and their details - using fields such as email, days, mobile etc.

    I now need a new field called ‘Team’ - which will use either a checkbox, radio button, drop-down.. fieldtype. This will be manually populated (team1, team2, team3 ...)

    What i need to know is how do i get the entries to appear, based on what was selected for the ‘Team’ option? Eg. All entries for team1 will appear under the team1 heading, and so on.

    TEAM 1 (heading)

    Staff Member 5

    TEAM 3 (heading)

    Staff Member 6
    Staff Member 3
    Staff Member 2

    TEAM 6 (heading)

    Staff Member 4
    Staff Member 1


    Of course there may be an instance that there are no staff entries with a certain team selected. In that case the Team heading will not not appear on the page. (See above, no staff with a team 2,4 or 5)

    Any help is appreciated!

  • #2 / Dec 23, 2011 12:13pm

    Rob Allen

    3105 posts

    One way to go would be to have the Team names as a category group, then you assign each entry to the appropriate category.

    To list team members you could then use the Category archive tag - http://ellislab.com/expressionengine/user-guide/modules/channel/category_archive.html

  • #3 / Dec 26, 2011 1:54am

    ZEDG

    32 posts

    Thanks for that. I have created the category (groups) and the archive list makes all entries appear correctly. However i need more than just the staff names/titles to appear. As you can see in the code below, there are columns for further info relating to each staff member.

    Using this code, each staff member appears under their own team/category heading, but i need all related staff members to appear under the one team/category heading.

    I couldnt see how i could incorporate exp:channel:entries within the category_archive tag (so that the days/ext/mob info columns will appear next to the staff/title).

    Or not possible?

    <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="334"><h4>NAME</h4><p></td><br />
                <td width="140"></p><h4>DAYS</h4><p></td><br />
                <td width="60"></p><h4>EXT</h4><p></td><br />
                <td width="100"></p><h4>MOBILE</h4><p></td><br />
              </tr><br />
    {exp:channel:entries channel="intranet_staff" orderby="title" sort="asc"}<br />
              <tr><br />
                <td colspan="4">{categories}</p><h3>{category_name}</h3><p>{/categories}</td><br />
              </tr><br />
              <tr><br />
                <td><a href="mailto:{staff_email}">{title}</a></td><br />
                <td>{staff_days}</td><br />
                <td>{staff_ext}</td><br />
                <td>{staff_mobile}</td><br />
              </tr><br />
              <tr><br />
                <td colspan="4"><i>{staff_position}</i></td><br />
              </tr><br />
    {/exp:channel:entries}<br />
          </table>


    ie, the category_archive tag allows the category name, and related title entries to appear below it, however i need the further channgel info to also appear:

    category name 1
    title1   staff_days   staff_ext   staff_mobile   staff_position
    title2   staff_days   staff_ext   staff_mobile   staff_position

    category name 2
    title3   staff_days   staff_ext   staff_mobile   staff_position
    title4   staff_days   staff_ext   staff_mobile   staff_position
    title5   staff_days   staff_ext   staff_mobile   staff_position

  • #4 / Dec 27, 2011 7:36am

    Rob Allen

    3105 posts

    There’s an addon that would make this easy - http://devot-ee.com/add-ons/category-sorted-entries/ -  otherwise you’d need to nest a channel:entries tag inside the archive tag - there’s an example for EE1 in the wiki which you could get some clues - http://expressionengine.com/wiki/Category_Archives_with_Custom_Fields

  • #5 / Jan 09, 2012 11:10pm

    ZEDG

    32 posts

    I have been on a holiday but have now come back to this. I have downloaded the addon and it works perfectly, just like i needed!

    Just wanted to say thanks for your help. Without your response i would not have known about the plugin and therefore would have never been able to get the data to appear as i and my client wanted.

    Thank you very much.

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

ExpressionEngine News!

#eecms, #events, #releases