0

I have a node with a lot of images and I want to convert this images in a <ul>-list. So I created a node.tpl-overwrite page and tried to alter my HTML, but with no result.

 <div class="content"<?php print $content_attributes; ?>>
    <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['comments']);
      hide($content['links']);
      print render($content['field_themes_body']);
    ?>
    <div class="theme_slider">
        <ul>
        <?php
          dpm($content['field_themes_images']);
          //print theme_item_list($content['field_themes_images']);
        ?>
      </ul>
    </div>
  </div>

It seems like the dpm of the $content['field_themes_image'] contains a whole array with all kinds of properties... Is it possible to filter out the images path only?

I've looked at the theme_item_list-function, but with no luck (or I did it wrong).

  • do you have individual fields or do you have one field with multiple images? – Mohammed Shameem Jan 18 '13 at 8:04
  • One field with multiple images. Multiple fields isn't an option btw... – Michiel Jan 18 '13 at 8:05
1

The following should work for you.

      hide($content['field_themes_images']);  
      <div class="theme_slider">
        <ul>
        <?php
          foreach ($content['field_themes_images']['#items'] as $key => $img)
          {
            print "<li>";
            print render($content['field_themes_images'][$key]); 
            print "</li>";
          } 
        ?>
      </ul>
    </div>
  </div>
  • Please don't add 'Hope that helps' and signatures to posts - your name is already visible at the bottom right of the post, and by answering the question I think we can assume you hope to help :) – Clive Jan 19 '13 at 11:03
  • will take care of that in future :-) – Mohammed Shameem Jan 19 '13 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.