If and foreach in drupal templates
Sunday, 3 August, 2008 - 20:51
Examples of using if and foreach in drupal or general php templates:
<?php if($test == 1): ?>
do something
<?php endif; ?>
<?php if($test == 1): ?>
do something
<?php else: ?>
do something else
<?php endif; ?>
<?php foreach($items as $item): ?>
<?php echo $item->getTitle(); ?>
<?php endforeach; ?>
Add new comment