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.

How best to structure list-based entries

September 12, 2012 4:41am

Subscribe [2]
  • #1 / Sep 12, 2012 4:41am

    Rick Lecoat

    128 posts

    I’m in a dilemma over how best to structure some content via my channel entry fields (and, subsequently, in the template) and I’d be interested in hearing other people’s take on the subject.

    The content in question is short ‘user guide’. It consists of three or four sections, with each section being comprised of an ordered list with maybe 7 or 8 list items (the exact number varies from section to section). Each list item, in turn, contains an H3 heading and a paragraph element. The client will want to add more sections later.

    Two solutions of how to structure this seem obvious, but each has distinct downsides. They are:

    1. Each section is one channel entry, and the channel’s custom entry fields consist of a long chain of ‘heading’ and ‘bodytext’ pairs (heading_1, text_1, heading_2, text_2, etc) with the headings being text inputs and the body text fields being text areas. This prevents the client from having to deal with any markup (they are not HTML savvy) because each field’s variable can be placed inside the appropriate HTML tag in the template. However, it also makes for a horrible, unwieldy publishing page. It also means that I have to anticipate the maximum number of list items and provide at least that number of heading/bodytext pairs, and the template becomes a morass of conditional statements to ensure that no empty H3 and P tags are left on the page if an entry uses only a few of the header/bodytext pairs.

    2. Each section is one channel entry, as before, but this time the channel has only one custom entry field, and this holds the content together with its structural markup—that is, everything including the OL, LI, H3 and P elements. This makes for a much simpler template and a less confusing publish page, but it introduces html into the publishing field and I can see that going horribly wrong as soon as the client tries to update the User Guide themselves.

    I can’t believe that this is an uncommon scenario, so I’d love to hear how others have approached it.
    Many thanks,
    Rick

  • #2 / Sep 12, 2012 1:37pm

    Rob Allen

    3114 posts

    I’d say this may be an excellent use for Matrix - https://pixelandtonic.com/matrix + P&T list http://pixelandtonic.com/divebar

    I’ve done very similar things, matrix will allow you to define a set of entry fields, one of your “sections” per Matrix row. The good bit is that your client will then be able to add as many rows/sections as they want and your matrix template tag will simply loop the sections automatically.

  • #3 / Sep 13, 2012 7:02am

    Rick Lecoat

    128 posts

    Hi Rob, thanks for your input on this. For the time being I’ve simply opted for the ‘multiple entry fields and lots of conditionals’ solution just to get the data in place, but if time permits at the end of the project I may well go back and improve that using one of your methods. Matrix might be a bit of overkill (and I’m already wrestling with getting my head around Playa, so trying to shoehorn yet another learning curve into my head right now might be overly-ambitious), but the P&T List plugin looks like it might do the trick.

    Thanks again for you help.

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

ExpressionEngine News!

#eecms, #events, #releases