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.

{if} and custom fields

August 04, 2010 6:24pm

Subscribe [3]
  • #1 / Aug 04, 2010 6:24pm

    Euan

    214 posts

    I have a custom field which is radio buttons with two options - App or Web.

    In the template I want to display one image if the entry is App and a different image if it’s Web.

    Is there any way to do this? I’ve searched the docs but with no success.

  • #2 / Aug 20, 2010 5:55pm

    Green Egg Media

    111 posts

    You should be able to do this:

    {if custom_field="App"}
       app_image.ext
    {if:elseif custom_field="Web"}
       web_image.exp
    {/if}
  • #3 / Aug 26, 2010 4:16pm

    John Ryan

    51 posts

    Or if it’s an icon that’s not content, more for display - you could have a CSS class for each that places the correct icon. Then in your template add the class from the custom field:

    <div class="{custom_field}">
        ... content for each entry ...
    </div>

    You can then create different styles for both:

    .app {
        background: url(app-icon.gif) no-repeat left top;
    }
    .web {
        background: url(web-icon.gif) no-repeat left top;
    }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases