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.

Syntax for conditional to display Custom Field

January 26, 2013 10:05am

Subscribe [1]
  • #1 / Jan 26, 2013 10:05am

    Stephen O'Connor

    24 posts

    Hi,

    This is a real newby question but here goes… :red:

    I want to display the contents of a custom field on a page only if that custom field has been filled out by the client. I have a ‘page’ template with several custom fields, one of them being a gallery {page_gallery} which is not a required field. I take it I have to use some sort of {if} statement but so far I can’t figure it out. Can someone help me please?

    Basically:
    If {page gallery} has been filled out
    add code for page gallery
    if not
    leave blank
    end if

    Thanks.

  • #2 / Jan 26, 2013 10:15am

    Stephen O'Connor

    24 posts

    It’s cool, I think I’ve figured it out ...

    {if page_gallery}
         <div id="gallery" class="clearfix">
                      {page_gallery}
                       <div class="galleryImage">
                           <a href="http://{large_image}" rel="lightbox-minx" title="{image_caption}">{small_image}</a>
                          </div>
                            {/page_gallery}    
                     </div><!-- End gallery -->
        {/if}

    Thanks anyways.

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

ExpressionEngine News!

#eecms, #events, #releases