If and foreach in drupal templates
Submitted by ivan on Sun, 03/08/2008 - 20:51
Examples of using if and foreach in drupal or general php templates:
<?php if($test == 1): ?> <div>do something</div> <?php endif; ?> <?php if($test == 1): ?> <div>do something</div> <?php else: ?> <div>do something else</div> <?php endif; ?> <?php foreach($items as $item): ?> <?php echo $item->getTitle(); ?> <?php endforeach; ?>

