Hi im using contemplate and CCK fields for generating page with Gallery formatter here is the field in template:

<div class="field field-type-filefield field-field-gallery01">
    <?php foreach ((array)$node->field_gallery01 as $item) { ?>
      <div class="field-item"><?php print $item['view'] ?></div>
    <?php } ?>
</div>

but problem is when generate empty DIVs as many as gallery have pictures here is HTML:

<div class="innerleft"><div class="field field-type-filefield field-field-slika01">
          <div class="field-item"><div class="galleryformatter galleryview galleryformatter-greenarrows">
  <div class="gallery-slides" style="width: 350px; height: 262px;">
    <div class="gallery-frame">
      <ul>

              <li class="gallery-slide" id="slide-0-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_1.jpg" alt="345807_1.jpg" title="example image 1"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-1-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_2.jpg" alt="345807_2.jpg" title="example image 2"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-2-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_3.jpg" alt="345807_3.jpg" title="example image 3"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-3-field_gallery01-6">

          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_4.jpg" alt="345807_4.jpg" title="example image 4"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-4-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_5.jpg" alt="345807_5.jpg" title="example image 5"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-5-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_6.jpg" alt="345807_6.jpg" title="example image 6"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
              <li class="gallery-slide" id="slide-6-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_7.jpg" alt="345807_7.jpg" title="example image 7"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>

              <li class="gallery-slide" id="slide-7-field_gallery01-6">
          <img src="http://example.com/sites/default/files/imagecache/galleryformatter_slide/345807_8.jpg" alt="345807_8.jpg" title="example image 8"  class="imagecache imagecache-galleryformatter_slide" width="350" height="262" />                  </li>
            </ul>
    </div>
  </div>
    <div class="gallery-thumbs" style="width: 350px;">
    <div class="wrapper">
      <ul>

                  <li class="slide-0" style="width: 92px;"><a href="#slide-0-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_1.jpg" alt="345807_1.jpg" title="example image 1"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-1" style="width: 92px;"><a href="#slide-1-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_2.jpg" alt="345807_2.jpg" title="example image 2"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-2" style="width: 92px;"><a href="#slide-2-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_3.jpg" alt="345807_3.jpg" title="example image 3"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-3" style="width: 92px;"><a href="#slide-3-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_4.jpg" alt="345807_4.jpg" title="example image 4"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-4" style="width: 92px;"><a href="#slide-4-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_5.jpg" alt="345807_5.jpg" title="example image 5"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-5" style="width: 92px;"><a href="#slide-5-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_6.jpg" alt="345807_6.jpg" title="example image 6"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-6" style="width: 92px;"><a href="#slide-6-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_7.jpg" alt="345807_7.jpg" title="example image 7"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
                  <li class="slide-7" style="width: 92px;"><a href="#slide-7-field_gallery01-6"><img src="http://example.com/sites/default/files/imagecache/galleryformatter_thumb/345807_8.jpg" alt="345807_8.jpg" title="example image 8"  class="imagecache imagecache-galleryformatter_thumb" width="92" height="69" /></a></li>
              </ul>

    </div>
  </div>
  </div>
</div>
          <div class="field-item"></div>
          <div class="field-item"></div>
          <div class="field-item"></div>
          <div class="field-item"></div>
          <div class="field-item"></div>

          <div class="field-item"></div>
          <div class="field-item"></div>
          <div class="field-item"></div>
          <div class="field-item"></div>
    </div></div>

and problem is how to remove those empty DIVs:

<div class="field-item"></div>....

Comments

draganFSD’s picture

i got it :)
here is a simple solution code for gallerz field in content template:

<div class="field field-type-filefield field-field-gallery01">
    <?php foreach ((array)$node->field_gallery01 as $item) { ?>
      <?php print $item['view'] ?>
    <?php } ?>
</div>
draganFSD’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.