Last active
December 19, 2015 17:28
-
-
Save mynameispj/5991363 to your computer and use it in GitHub Desktop.
Drupal 7 Field Collections - Loop to avoid cruft markup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$front_page = node_load("1"); | |
foreach ($front_page->field_slideshow_images['und'] as $key => $value) { | |
$slide = entity_load('field_collection_item', array($value['value'])); | |
$idx = $value['value']; | |
?> | |
<div class="rsContent slide"> | |
<img src="<?php print image_style_url('none', $slide[$idx]->field_image['und']['0']['uri']); ?>" class="rsImg"> | |
<div class="projectInfo"> | |
<p><?php print $slide[$idx]->field_title_of_project['und']['0']['value']; ?></p> | |
<p><?php print $slide[$idx]->field_place['und']['0']['value']; ?></p> | |
</div> | |
</div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment