div format
-
Having problem with my div format
This code is working and…
<?php $last_band = null; foreach ( $bandinfo as $infoband ) : ?> <?php if ($last_band != $infoband['band1']): ?> <h3><?php echo $infoband['band1']; ?></h3> <?php endif; ?> <?php echo $infoband['lineup']; ?> <?php echo $infoband['year']; ?><br> <?php $last_band = $bandinfo['band1']; endforeach; ?>
it gives me this result
Band1
lineup1 year1
lineup2 year2
lineup3 year3Band2
lineup1 year1
lineup2 year2
lineup3 year3Now I want this format instead
Band1
<div>
lineup1 year1
lineup2 year2
lineup3 year3
</div>Band2
<div>
lineup1 year1
lineup2 year2
lineup3 year3
</div>and have tried this code but only get errors like
Parse error: syntax error, unexpected T_AS in …<?php $max = count($bandinfo); for ( $i = 0; $i < $max; $i++) $bandinfo as $infoband ) : $infoband = $bandinfo[$i]; ?> <?php if ($i == 0 || $bandinfo[$i-1]['band1'] != $infoband['band1']): ?> <h3><?php echo $infoband['band1']; ?></h3> <div class="bandinfo"> <?php endif; ?> <?php echo $infoband['lineup']; ?> <?php echo $infoband['year']; ?><br> <?php <?php if ($i == $max-1 || $bandinfo[$i+1]['band1'] != $infoband['band1']): ?> </div> <?php endif; ?> endforeach; ?>
Have anyone some suggestion?
- The topic ‘div format’ is closed to new replies.