title: Editing a php scripèt divs to output a table
body: <p>Hey guys ok so i'm wokring on a clients Weekly Newsletter i'm working with Joomla 2.5.19 and using the enterprise version of acymailling to send it out. I'm kicking my heading in at the moment because of outlook, i'm using a module from Jreviews that publishes the latest reviews submitted to the site in the newsletter, it all works fine except in outlook. </p>
  
  <p>the out put of the script is meant to be a 2x2table with the 4 latest reviews in it. the only prob is outlook seems to hates me using Div for a table and stacks the 2x2 table into a verticle kaotic mess.</p>
  
  <p>the code i'm trying to edit is:</p>
  
  <p>'></p>
  
  <pre><code>&lt;?php /* root element for the items */ ?&gt;
  &lt;div class="jrModuleItems &lt;?php echo $orientation . ' jrThumbnail'.ucfirst($tn_position); ?&gt;"&gt;
  
      &lt;?php /* new page starts here */
          $pages = array_chunk($reviews,$limit);
          $j=0;
          foreach($pages AS $page):
          ?&gt;
  
      &lt;div class="jr-results jrResults jrModuleContainer jrReviewsModule"&gt;
  
          &lt;?php $i=0;
                while(!empty($page)):
                  $i++; $j++; $review = array_shift($page); ?&gt;
  
              &lt;?php
              // Process link title
              $listing_title = ($listing_title_chars &amp;&amp; mb_strlen($review['Listing']['title'])&gt;$listing_title_chars) ? $Text-&gt;truncate($review['Listing']['title'],$listing_title_chars) : $review['Listing']['title'];
              $review_title = ($review_title_chars &amp;&amp; mb_strlen($review['Review']['title'])&gt;$review_title_chars) ? $Text-&gt;truncate($review['Review']['title'],$review_title_chars) : $review['Review']['title'];
              $link_title = str_replace('{listing_title}',$listing_title,$link_title_format);
              $link_title = str_replace('{review_title}',$review_title,$link_title);
  
              // Create the thumbnail
              $tn_show and $mainMediaThumb = $Media-&gt;thumb(Sanitize::getVar($review,'MainMedia'),array('listing'=&gt;$review,'size'=&gt;$tn_size,'mode'=&gt;$tn_mode,'css_size'=&gt;true));
              ?&gt;
  
              &lt;?php $lastItem = ($i == $columns) ? ' jrLastItem' : ''; ?&gt;
  
              &lt;div class="jrModuleItem&lt;?php echo $lastItem; ?&gt;" style="width: &lt;?php echo $item_width; ?&gt;%; padding-right: &lt;?php echo $item_padding; ?&gt;%;"&gt;
  
                  &lt;?php if($show_numbers):?&gt;&lt;div class="jrModuleItemNumber"&gt;&lt;?php echo $j;?&gt;.&lt;/div&gt;&lt;?php endif;?&gt;
  
                  &lt;?php if($tn_show &amp;&amp; $mainMediaThumb &amp;&amp; $tn_position != 'bottom'):?&gt;
  
                      &lt;!-- Listing Thumbnail --&gt;
                      &lt;div class="jrModuleItemThumbnail"&gt;
                          &lt;?php echo $Html-&gt;sefLink($mainMediaThumb,$review['Listing']['url']);?&gt;
                          &lt;?php // Uncomment line below to show reviewer avatar. You can comment or remove the thumbnail code above
                              // echo $Community-&gt;avatar($review);
                          ?&gt;
                      &lt;/div&gt;
  
                  &lt;?php endif;?&gt;
  
                  &lt;div class="jrModuleItemContent"&gt;
  
                      &lt;!-- Listing Title --&gt;
                      &lt;div class="jrModuleItemTitle"&gt;
  
                          &lt;?php echo $Html-&gt;sefLink($link_title,$review['Listing']['url']);?&gt;
  
                          &lt;?php if(Sanitize::getString($review['Listing'],'tag')):?&gt;
  
                              &lt;span class="jrComponentLabel jrStatusLabel jrBlue"&gt;
  
                                  &lt;?php echo Sanitize::getString($review['Listing'],'tag');?&gt;
  
                              &lt;/span&gt;
  
                          &lt;?php endif;?&gt;
  
                      &lt;/div&gt;
  
                      &lt;!-- Rating --&gt;
                      &lt;?php if ( $review['Criteria']['state'] == 1 ):?&gt;
                      &lt;div class="jrOverallRatings"&gt;
                          &lt;?php if($review['Review']['editor'] == 1):?&gt;
                              &lt;?php
                                  $rating_stars = $Rating-&gt;drawStars($review['Rating']['average_rating'], $this-&gt;Config-&gt;rating_scale, 'editor');
                                  $rating_value = $Rating-&gt;round($review['Rating']['average_rating'],$this-&gt;Config-&gt;rating_scale);
                              ?&gt;
                              &lt;div class="jrOverallEditor" title="&lt;?php  __t("Editor rating"); ?&gt;"&gt;
                                  &lt;div class="jrRatingStars"&gt;&lt;?php echo $rating_stars ?&gt;&lt;/div&gt;
                                  &lt;span class="jrRatingValue"&gt;&lt;?php echo $rating_value?&gt;&lt;/span&gt;
                              &lt;/div&gt;
                          &lt;?php else:?&gt;
                              &lt;?php
                                  $rating_stars = $Rating-&gt;drawStars($review['Rating']['average_rating'], $this-&gt;Config-&gt;rating_scale, 'user');
                                  $rating_value = $Rating-&gt;round($review['Rating']['average_rating'],$this-&gt;Config-&gt;rating_scale);
                              ?&gt;
                              &lt;div class="jrOverallUser" title="&lt;?php  __t("User rating"); ?&gt;"&gt;
                                  &lt;div class="jrRatingStars"&gt;&lt;?php echo $rating_stars ?&gt;&lt;/div&gt;
                                  &lt;span class="jrRatingValue"&gt;&lt;?php echo $rating_value?&gt;&lt;/span&gt;
                              &lt;/div&gt;
                          &lt;?php endif;?&gt;
                      &lt;/div&gt;
                      &lt;?php endif;?&gt;
  
                      &lt;!-- Reviewer name --&gt;
                      &lt;div class="jrModuleItemReviewer"&gt;
                          &lt;span class="reviewer"&gt;&lt;?php __t("Reviewed by");?&gt; &lt;?php echo $Community-&gt;screenName($review);?&gt;&lt;/span&gt;
                      &lt;/div&gt;
  
                      &lt;?php if($fields): ?&gt;
  
                      &lt;!-- Custom Fields --&gt;
                      &lt;div class="jrModuleFields"&gt;
  
                          &lt;?php
                              foreach ($fields as $field):
                              $field = trim($field);
                              $field_value = $CustomFields-&gt;field($field,$review);
                          ?&gt;
                          &lt;?php if($field_value != ''):?&gt;
                          &lt;div class="jrModuleFieldDiv &lt;?php echo lcfirst(Inflector::camelize($field)); ?&gt;"&gt;
                              &lt;span class="jrModuleFieldTitle"&gt;&lt;?php echo $CustomFields-&gt;label($field, $review); ?&gt;: &lt;/span&gt;
                              &lt;span class="jrModuleFieldValue"&gt;&lt;?php echo $field_value; ?&gt;&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;?php endif;?&gt;
  
                          &lt;?php endforeach; ?&gt;
  
                      &lt;/div&gt;
  
                      &lt;?php endif;?&gt;
  
  
                      &lt;?php if($show_comments &amp;&amp; trim($review['Review']['comments'])!=''):?&gt;
                      &lt;!-- Review Comments --&gt;
                      &lt;div class="jrModuleItemInfo"&gt;
                          &lt;?php
                              // Uncomment line below to show review title
                              // echo '&lt;strong&gt;' . $review['Review']['title'] . '&lt;/strong&gt;&lt;br /&gt;';
                          ?&gt;
                          &lt;span class="comments"&gt;"&lt;?php echo $Text-&gt;truncateWords($review['Review']['comments'],$comments_words,'...');?&gt;"&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;?php endif;?&gt;
                  &lt;/div&gt;
  
                  &lt;?php if($tn_show &amp;&amp; $mainMediaThumb &amp;&amp; $tn_position == 'bottom'):?&gt;
  
                      &lt;!-- Listing Thumbnail --&gt;
                      &lt;div class="jrModuleItemThumbnail"&gt;
                          &lt;?php echo $Html-&gt;sefLink($mainMediaThumb,$review['Listing']['url']);?&gt;
                          &lt;?php // Uncomment line below to show reviewer avatar. You can comment or remove the thumbnail code above
                              // echo $Community-&gt;avatar($review);
                          ?&gt;
                      &lt;/div&gt;
  
                  &lt;?php endif;?&gt;
  
              &lt;/div&gt;
  
             &lt;?php  /*end of row , start new row*/
                  if(!empty($page) &amp;&amp; ($i == $columns || $total == $j)):?&gt;
                  &lt;div class="jrDivider"&gt;&lt;/div&gt;
                  &lt;?php $i=0; endif;?&gt;
  
          &lt;?php endwhile;?&gt;
  
      &lt;/div&gt;
  
      &lt;?php endforeach; /* new page ends here */?&gt;
  
  &lt;/div&gt;&lt;?php /* end items root element */?&gt;
  </code></pre>
  
  <p></p>
  
  
  
  <p>Does any one have the slightest idea how i could turn this into a for loop that outputs a table?</p>