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.

Too Many File Fields (and not enough pics to go around)

May 04, 2011 3:58pm

Subscribe [2]
  • #1 / May 04, 2011 3:58pm

    daczac

    32 posts

    Hi There,

    I was wondering if anyone ever ran into this issue. I have a slideshow for each business that I am featuring on my site (there are several). I have set up my file fields for each business to receive a maximum of six photos for their slideshow. When it’s time to publish the channel, of course it wants six pictures. What happens if I only have say three photos available for that business to uploaded into my channel and I have to leave the other fields empty. How can I set this up so that I don’t get blank photos in the slideshow when three of my six fields are left empty in the channel and without photos? Is there an “if/then” statement I could use for this somehow so I don’t have to code in six actual channel entries? Here is my JQuery slide show where you can see this happening where the last three photo slots are blank:
    http://pncagr.ca/index.php/farms/detail/farm_j_m_mountain_farm_u_pick
    Thanks… dave

  • #2 / May 04, 2011 4:04pm

    Boyink!

    5011 posts

    This is a spot where using Matrix would be best - that way you don’t need to define a maximum, you just upload as many photos as needed.

    It’s the approach I use on our travel site for per-entry photo galleries:
    http://boyinks4adventure.com/our-travels/grand-canyon/

    You can grab some sample templates here:
    http://www.train-ee.com/courseware/free-tutorials/comments/boyinks4adventure-the-rv/

  • #3 / May 04, 2011 4:05pm

    Boyink!

    5011 posts

    Otherwise you can use a conditional to check a field to see if it has content:

    {if custom_field !=""}
      Show it
    {/if}
  • #4 / May 04, 2011 4:30pm

    daczac

    32 posts

    Thanks for the suggestions… I would like to try Matrix; but first, seeing my lack of experience with conditionals, I would like to try this first, get that working and the implement Matrix. So far in my channel entry I have the following:

    {exp:channel:entries channel="all_farms" disable="member_data|trackbacks" limit="1"}
      <div id=“myslides”>
      {if farm_pic1 =1ZBRgaFrGqVEtLhpzvkZiHy0YNa1bZ9Btypography_img_src_end alt={farm_pic1} title={farm_pic1} width=280 height=280 border=0
      </div>
      {prev_next}
    {/exp:channel:entries}

    I must not have this right as the photo in the slideshow doesn’t appear. Thanks… dave

  • #5 / May 04, 2011 4:35pm

    Boyink!

    5011 posts

    Generally the approach is:

    {if farm_pic1 !=""}
      farm_pic1
    {/if}
  • #6 / May 04, 2011 4:48pm

    daczac

    32 posts

    Works great! Thanks for your help.

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

ExpressionEngine News!

#eecms, #events, #releases