Joomla 1.5 - Blog Loop


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. $divider = '';
  3. if ($this->params->def('multi_column_order', 0)) : // order across, like front page
  4. for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) :
  5. if ($z > 0) : $divider = " column_separator"; endif; ?>
  6. <?php
  7. $rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns'));
  8. $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns'));
  9. ?>
  10. <td valign="top"
  11. width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%"
  12. class="article_column<?php echo $divider ?>">
  13. <?php
  14. $loop = (($z < $cols)?1:0) + $rows;
  15.  
  16. for ($y = 0; $y < $loop; $y ++) :
  17. $target = $i + ($y * $this->params->get('num_columns')) + $z;
  18. if ($target < $this->total && $target < ($numIntroArticles)) :
  19. $this->item =& $this->getItem($target, $this->params);
  20. echo $this->loadTemplate('item');
  21. endif;
  22. endfor;
  23. ?></td>
  24. <?php endfor;
  25. $i = $i + $this->params->get('num_intro_articles', 4) ;
  26. else : // otherwise, order down, same as before (default behaviour)
  27. for ($z = 0; $z < $this->params->get('num_columns'); $z ++) :
  28. if ($z > 0) : $divider = " column_separator"; endif; ?>
  29. <td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
  30. <?php for ($y = 0; $y < ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); $y ++) :
  31. if ($i < $this->total && $i < ($numIntroArticles)) :
  32. $this->item =& $this->getItem($i, $this->params);
  33. echo $this->loadTemplate('item');
  34. $i ++;
  35. endif;
  36. endfor; ?>
  37. </td>
  38. <?php
  39. endfor;
  40. endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.