Title: div format
Last modified: August 20, 2016

---

# div format

 *  Resolved [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * (@rogersundstrom)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/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 year3
 * Band2
    lineup1 year1 lineup2 year2 lineup3 year3
 * Now 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?

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/div-format/page/2/?output_format=md) [→](https://wordpress.org/support/topic/div-format/page/2/?output_format=md)

 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183744)
 * Can you provide the full error please?
 *  Thread Starter [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * (@rogersundstrom)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183745)
 * Parse error: syntax error, unexpected T_AS in /home/angelita/public_html/eme/
   eme/wp-content/plugins/pods/components/Pages.php(480) : eval()’d code on line
   119
 * and line 119 are “for ( $i = 0; $i < $max; $i++) $bandinfo as $infoband )” :
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183746)
 * Looks like an issue with wp-content/plugins/pods/ plugin…use well used and popular
   plugins only…
 *  Thread Starter [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * (@rogersundstrom)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183749)
 * Can be so, but I think Pods are well used and popular plugins.
    [http://wordpress.org/extend/plugins/pods/](http://wordpress.org/extend/plugins/pods/)
 * I see I have one “)” to much in that line and have removed it but with same result.
   
   I think I doing something wrong here for ( $i = 0; $i < $max; $i++) $bandinfo
   as $infoband : $infoband = $bandinfo[$i]; ?>
 *  [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183750)
 * That’s an error that comes out when PHP runs inside an eval() but is malformed.
 * This line is invalid:
 * `for ( $i = 0; $i < $max; $i++) $bandinfo as $infoband ) :`
 *  Thread Starter [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * (@rogersundstrom)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183752)
 * Hi Scott,
    How to do it right then?
 * I want this result
 * Band1
    <div> lineup1 year1 lineup2 year2 lineup3 year3 </div>
 * Band2
    <div> lineup1 year1 lineup2 year2 lineup3 year3 </div>
 * Instead of this
    Band1 lineup1 year1 lineup2 year2 lineup3 year3
 * Band2
    lineup1 year1 lineup2 year2 lineup3 year3
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/div-format/#post-3183753)
 * Good SEO can get a plugin to 100K here – a good plugin has 3M+ downloads…
    [http://wordpress.org/extend/plugins/browse/popular/](http://wordpress.org/extend/plugins/browse/popular/)
 *  [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183754)
 * Maybe this?
 *     ```
       <?php
       $last_band = null;
       foreach ( $bandinfo as $infoband ) : ?>
   
           <?php if ($last_band != $infoband['band1']): ?>
               <h3><?php echo $infoband['band1']; ?></h3>
               <div>
           <?php endif; ?>
   
           <?php echo $infoband['lineup']; ?> <?php echo $infoband['year']; ?><br>
   
           <?php if ($last_band != $infoband['band1']): ?>
               </div>
           <?php endif; ?>
   
       <?php
           $last_band = $bandinfo['band1'];
       endforeach; ?>
       ```
   
 *  [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183755)
 * Seacoast Web Design, Pods is well known and popular, and has 114k downloads right
   now. A good plugin does not have to have 3M+ downloads, that’s irrelevant and
   there are lots of bad plugins out there with tons of downloads.
 *  Thread Starter [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * (@rogersundstrom)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183756)
 * That plugin with 5M+ downloads don’t help me right now 🙂
    I´m working with pods
   now and as Scott says my line is malformed and invalid. So with correct code 
   I´m on…
 *  [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183757)
 * I’m the lead developer on the Pods Framework project, Roger, just let me know
   if you have any further problems, I’ll help if I’ve got the time. I usually keep
   an ear out for any mentions of Pods so I can provide support.
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183760)
 * Pods, can you add a link to your WP support?
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183761)
 * Here it is: [http://wordpress.org/support/plugin/pods](http://wordpress.org/support/plugin/pods)
 * Again – just because some download it, does not mean they use it…based on forum
   support questions over a long period, I say few use it…
 *  [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183762)
 * We have a pretty active forum over at [http://podsframework.org/forums/](http://podsframework.org/forums/)
 * We run our own forums separate from the WP support forums, but continue to support
   threads started on our WP support forums.
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/#post-3183763)
 * It’s pretty?

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/div-format/page/2/?output_format=md) [→](https://wordpress.org/support/topic/div-format/page/2/?output_format=md)

The topic ‘div format’ is closed to new replies.

## Tags

 * [as](https://wordpress.org/support/topic-tag/as/)
 * [code](https://wordpress.org/support/topic-tag/code/)
 * [div](https://wordpress.org/support/topic-tag/div/)
 * [for?](https://wordpress.org/support/topic-tag/for/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 26 replies
 * 3 participants
 * Last reply from: [rogersundstrom](https://wordpress.org/support/users/rogersundstrom/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/div-format/page/2/#post-3183776)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
