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.

Categories / conditionals and such

October 12, 2010 10:13pm

Subscribe [2]
  • #1 / Oct 12, 2010 10:13pm

    Marc Tiedemann

    119 posts

    I’ve got two questions regarding categories, all for the holy goal of making it easier for the client and to prevent display problems down the road:

    1. Is there a way to provide - let’s say - 4 categories for a specific channel but only to be able to choose ONE category (more like radiobuttons than checkboxes)?

    2. Is there a way to display a custom field only IF a certain category (ID) is selected? If any other category is selected nothing has to be displayed.

    Thanks! Marc

  • #2 / Oct 12, 2010 10:20pm

    Lisa Wess

    20502 posts

    Hi, Marc -

    the answer to both is currently no; however, those questions make me wonder if a channel would be a better option for those entries?  Those are by necessity only one choice, and custom fields are per channel already.

  • #3 / Oct 12, 2010 10:31pm

    Marc Tiedemann

    119 posts

    Lisa,

    I was afraid that you would answer no to both… and I was also afraid of you asking about channels and tada! here we go…

    I have so far installed EE about 5 times. The sites were never really badass complex, some very simple, some a bit complex. It took me quite some time to get the idea of EE, it’s channels (weblogs), categories, custom fields and all of this. So, actually I don’t know what you’re asking here really. I always configure channels with custom fields and custom categories.

    Now in this very case everything comes together. I’d say the channel I’m talking about here is quite complex. It has 11 eleven custom fields and 4 categories. And one of those custom fields should only be displayed if a certain category is selected. That was my idea at least.

    Maybe you can light me up a little…

  • #4 / Oct 12, 2010 10:34pm

    Lisa Wess

    20502 posts

    Hi, Marc,

    Well, I am working off limited information here.  A channel would restrict a person to a single choice - and then the custom fields would appear based on that choice, which seemed to fit your two criteria.

    If you need something like that within a channel then I’d wonder what your project’s actual goals are that a separate and distinct channel on its own wouldn’t be a better choice.  Perhaps you could share a bit more about your project and the community can give you some help on how to structure it.

  • #5 / Oct 12, 2010 11:38pm

    Marc Tiedemann

    119 posts

    OK, like I said I’m still easily confused by the EE “vocabulary” but I’ll give it a try:

    The project’s goal is to create a sort of “fan-page” or “supporters-page” for a northern german soccer-club.
    On the index page will be a News Blog in a pretty old-fashioned way: Title, Body, maybe different authors and categories, comments. No problems here.
    In the Sidebar of the index page aka. the News Site aka. the Blog there is supposed to be a match-schedule. Next matches, with results (to be entered after the game of course), Date, Time and such.

    Screenshot 1 shows the sidebar element so far (it’s german obviously but you’ll get the idea).

    Now, there is a note underneath the (fictious) game result “Bundesliga”. This is a category actually. Now, there are three more categories. Let’s say it would read “Champions League”, then I wouldn’t need the info “6. Spieltag” (Gameday 6) because there are no Gamedays in this sense in the Champions League. I simply don’t want this info to be shown.

    All the data is being entered via a Channel with 11 custom fields and the use of some Conditionals. Here is the whole code for this area of the site and Screenshot 2 shows the Edit Screen of the sample entry:

    
    
    

    The field “Spieltag” has one possible entry “-”. This is my workaround right now.

    At the end I want to show all games of the season in a probably jquery powered slider (past and future entries).

    Now I don’t even know if this post is a real question. So if there’s any info missing just tell me people.  😊

    Thanks and regards, Marc

  • #6 / Oct 13, 2010 7:22am

    Sophie Dennis

    31 posts

    Instead of using categories to select the League for each match, why add a “league” drop-down or radio button custom field to the spieltermine channel field group?

    This would give you the functionality to:
    a) limit selection to only one league per match
    b) write a conditional based on the custom field

    Let’s say
    - You give this custom field the shortname “league”
    - Set the available values to “Bundeslige” and “Champions League”

    So replace:

    {categories}
        {category_name}
    {/categories}
    
    {if spieltag != "-"}
        {spieltag}. Spieltag
    {/if}

    With:

    {league}
    
    {if league != "Champions League"}
        {spieltag}. Spieltag
    {/if}
  • #7 / Oct 13, 2010 11:37am

    Marc Tiedemann

    119 posts

    I’ve have thought about this before, too. But then I dismissed it because I wanted to give the client a little more fine grained search/sort power on the “Edit” entries screen because there will be a lot entries - at least 34 per season.

    But now when I come to think of it again and with your help it’s maybe a bad idea. It would probably be better to it your way AND instead add categories for the seasons, something like Season 10/11, Season 11/12…

    I’m thinking about the long run here and the usability of the whole thing in a couple of years.

    Man, if clients knew how much logical thinkwork’s involved in something that - at the end - looks so simple. 😉

  • #8 / Oct 13, 2010 12:55pm

    Sophie Dennis

    31 posts

    I hadn’t consider the edit screen usability.

    Some way to easily split into at least seasons would undoubtedly help there. Having a look at the CP, a couple of ideas would be to encourage them to use the Date Range - the “Last 365 days” would be an easy way to just see current season (depending on when you’re inputting matches).

    There is also the Keywords filter, which if you set to “Search titles and entries” would presumably search the drop-down/radio values? So they search for “Champions League” to find all CL matches.

    I haven’t dealt with a site with large numbers of posts myself, so maybe others will have good client-friendly suggestions.

    I guess you might want to have categories for seasons and leagues anyway (even if this doubles-up with a drop-down/radio option for matches) as I’m guessing you will want to be able to tag blog posts/news by league and season as well?

  • #9 / Oct 13, 2010 1:53pm

    Marc Tiedemann

    119 posts

    ...as I’m guessing you will want to be able to tag blog posts/news by league and season as well?

    Since I’m going to have to create another channel for the news/blog posts anyway, I suppose I’ll also add an extra category group just for that channel. Less confusion on the client side once again I guess.

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

ExpressionEngine News!

#eecms, #events, #releases