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.

Using Multi Select

March 22, 2011 1:31am

Subscribe [2]
  • #1 / Mar 22, 2011 1:31am

    Sunnyland

    66 posts

    Probably an easy one.  I have a site which displays other website where people can get help.  This is broken up into three categories - Agency’s, Support Services and Disability Services.  Some of the categories share the same info so I have setup a multi select box so the when a new site is entered the author can select which category this will display in.

    The problem is if I use {if category == "Agency"} then it will only be true if Agency is the only category selected (ie if Agency and Support Services is selected then the service doesn’t appear).  I tried search:body but that doesn’t search multi select and probably not the correct way to do it anyway.

    Any Ideas?

  • #2 / Mar 22, 2011 2:02am

    Cheif

    626 posts

    What are u trying to achieve per-se ?

  • #3 / Mar 22, 2011 2:07am

    Sunnyland

    66 posts

    I am building a backend using expression engine so that site authors can add service providers in any of three categories.  I would like them to be able to add one entry into multiple categories if needed.

  • #4 / Mar 22, 2011 2:16am

    Cheif

    626 posts

    That, I figured out by reading ur intial post… what are you trying to do with displaying the categories ?

  • #5 / Mar 22, 2011 2:26am

    Sunnyland

    66 posts

    Ok, when someone visits the site they have the choice of three main area’s - Support Services, Agencies and Disablity services.  These are broken up into alphabetical index displayed by letter.  Each letter contains a list of entries with the title of the service provider, discription and a link.  Providers will offer services in one or more of the categories.
    I have set up custom fields that have the Title, category(multi select), description and url.

    I just am unsure how to filter the entries based on the category field.

  • #6 / Mar 22, 2011 2:36am

    Sunnyland

    66 posts

    I have setup a temp link so you can see what I am trying to do:

    http://www.sdrc.zoomprint.com.au/sdrc/index.php

  • #7 / Mar 22, 2011 2:58am

    Cheif

    626 posts

    I still cant really see what you’re trying to achieve, that links runs sloooowwww but will make a few assumptions…

    You have a series of entries
    Each entry can belong to one or multiple categories
    You have a template set up to display ALL entries

    {exp:channel:entries channel="mychannel"}

    You want a template to filter the entries by category

    {exp:channel:entries channel="mychannel" category="1"// The id of the category assigned to entries you want to show}
    //Use the pipe character | to add multiple categories so 1|3|7

    This is very basic but a starting point 😊

  • #8 / Mar 22, 2011 3:22am

    Sunnyland

    66 posts

    Think I might of added some confusion by naming one of my custom fields “category”.  Gave you suggestion a go but didn’t work.

    To try and explain better so I have 3 separate pages(a,b,c) on my site the author enters the links into the backend of EE.  Link 1 needs to display on page a.  Link 2 displays on page a and b. Link 3 on page c and a.

    I setup a multi select so the author can select which page to display the link a, b or c.

    Is there a diffent way to do this I am new EE and I had a play with the category feature but could not figure out how to include the item in one category but no the other and vice versa.

  • #9 / Mar 22, 2011 3:30am

    Cheif

    626 posts

    Simplistically, categories would be simpler as there are in-built functions to handle them natively, as per my example above.

    My code made the incorrect assumption that you were using categories, my bad.

    If you’re using a dropdown list to handle the selection you could look at:
    http://ellislab.com/expressionengine/user-guide/modules/channel/parameters.html#par_search

    The “search:” parameter allows you to constrain Channel Entries output based on content within your custom fields

  • #10 / Mar 22, 2011 3:35am

    Sunnyland

    66 posts

    Thanks worked out how to categories and you are correct it is a lot easier than what I was tring to do.  Have made a few minor changes and it is now working how it should.  Just a matter of getting my head around the best way to do things in EE.

    Thanks again for your help.

  • #11 / Mar 22, 2011 1:15pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Cheif.

    Sunnyland - Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases