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.

multiple template options in one entry

September 10, 2007 5:59pm

Subscribe [3]
  • #1 / Sep 10, 2007 5:59pm

    bgunawan

    1 posts

    i need to create multiple template options when in an EE entry mode.

    Very simply, if the content is just in the body field, the a single column CSS displays.
    If a content is entered additionally to extended fields, then I need to display a 3 column CSS.

    Can someone sample if-statements using the {body} {summary} {extended} tags?
    I want to be able to organize my layouts based on templates. 

    If there is another way to do this,... then please ablige.

    Much appreciated.

  • #2 / Sep 10, 2007 6:04pm

    Lisa Wess

    20502 posts

    Do you mean something somewhat similar to this?

  • #3 / Sep 11, 2007 4:04am

    Yvonne Martinsson

    204 posts

    It all depends on how your design is, but why not try something like:

    {exp.weblog entries}
    {if extended}
    
    3 column  design - 
    <div1>{body}</div>
     <div2>{extended}</div>
    <div3>{summary}</div>
    
    {if:else}
    1 column design - <div4>{body}</div>
    {/if}
    
    {/exp.weblog entries}


    And make sure they have different ids so that you can layout them as you want.

  • #4 / Sep 11, 2007 8:51am

    e-man

    1816 posts

    Nice one Yvonne!
    Another way would be to just add a class to the body tag depending on there being an extended field or not and then style accordingly in your stylesheet.

    {exp.weblog entries}
    <body {if extended}class="has_extended"{if:else}class="single_column"{/if}
    >{/exp.weblog entries}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases