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.

Custom Fields in Channel Category Archive?

October 20, 2010 6:24am

Subscribe [4]
  • #1 / Oct 20, 2010 6:24am

    binocle

    68 posts

    Hi all,

    It’s been a while, and like every time I try to play again with EE, I feel very rusty…

    I would like to make a long list of links, sorted by category, like that:

    <ul>{Category Title}
    <li>{Entry_title}
    {custom field}
    </li>
    <li>{Entry_title}
    {custom field}
    </li>
    (...)
    </ul>
    
    <ul>{Category Title}
    <li>{Entry_title}
    {custom field}
    </li>
    <li>{Entry_title}
    {custom field}
    </li>
    (...)
    </ul>


    I figured I would use the Channel Category Archive Tag that seemed perfect for my use, but I can’t figure how to display my custom field within the tag.

    Is it possible?

    If not, what would be the easiest/best way to achieve that.

    Subsidiary question: what are the Category Custom Fields? I can’t understand how to use them either… :red:

    Thanks in advance for your time and your help.

  • #2 / Oct 20, 2010 10:30am

    3Easy

    44 posts

    Hello,

    I don’t believe what you are looking for is available out of the box. If you read the docs, the {exp:channel:category_archive} tag has variable pairs for {categories}{/categories} and {entry_titles}{/entry_titles} and its only the {categories} variable pair that has support for custom fields, not the {entry_titles} custom fields.

    So a quick note on your code. You are using {entry_title} as a single variable, when it is in fact a pair. Between a pair of {entry_title} tags you can access the {title} tag and only a couple of others. Check out the docs and note that there are a handful of tags available between a {categories} pair also. I need to ponder the rest.

  • #3 / Oct 20, 2010 10:43am

    3Easy

    44 posts

    Custom Category Fields are additional fields describing, or relating to a Category. For example an out of the box Category ships with Category Name, Category URL Title, Category Description, Category Image URL and you can choose a Category Parent. To add a Custom Category Field means to add a piece of information like the above.

    When you are inside a {categories}{/categories} variable pair you can access the single variables for all of the above and the {category_id} to boot. You would generally be a long way down the rabbit hole if you were adding Custom Category Fields, they definitely have a place but wouldn’t be commonly used I would guess (happy to be proved wrong).

    http://ellislab.com/expressionengine/user-guide/cp/admin/content_admin/category_management.html
    http://ellislab.com/expressionengine/user-guide/modules/channel/category_archive.html#variable_pairs

  • #4 / Oct 20, 2010 10:49am

    3Easy

    44 posts

    Consulting the docs myself, there isn’t a way to access on of your Custom *Channel* Fields in the way you wish. There are good solid reasons for this, having looked at the core module code that renders this kind of thing recently, you cannot underestimate its complexity.

    So what are your options? You could write code that loops through your Categories manually and pulls in Custom Channel Fields or you explore the Add-on market where such things as Navigator or Structure might help you. Start looking at http://devot-ee.com/. Good luck.

  • #5 / Oct 20, 2010 10:55am

    binocle

    68 posts

    Thanks for your comments.

    My code was just a quick exemple of the stucture I would like to obtain, sorry if it is confusing.

    Basically, I would like to have:

    Category 1
    - entry title 1
      entry custom field 1

    - entry title 2
      entry custom field 2


    Category 2
    - entry title 3
      entry custom field 3

    - entry title 4
      entry custom field 4


    I have indeed read the doc, and I can’t figure if it is possible easily or not. I think not…

    So what are my better option? Hard-code the categories titles and use multiples {exp:channel:entries}? Seems “messy”…

    I am certainly not the first one to try to achieve that kind of list, and would love any advice.

    Thanks in advance

  • #6 / Oct 20, 2010 6:01pm

    Lisa Wess

    20502 posts

  • #7 / Oct 21, 2010 5:02am

    binocle

    68 posts

    Thank you, I’ll take a look ^__^

  • #8 / Oct 21, 2010 5:25am

    Ingmar

    29245 posts

    Cool. Let us know how it goes, please.

  • #9 / Oct 21, 2010 1:07pm

    binocle

    68 posts

    Sorry, I didn’t have to use this. The structure and the data changed in a not so systematic way, so I use finally several entries with a bunch of links within…

    Next time 😉

  • #10 / Oct 21, 2010 3:21pm

    Ingmar

    29245 posts

    So, you’re good?

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

ExpressionEngine News!

#eecms, #events, #releases