Return to Snippet

Revision: 45733
at May 6, 2011 13:31 by beneberle


Initial Code
<?php
$divider = '';
	if ($this->params->def('multi_column_order', 0)) : // order across, like front page
	     for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) :
	          if ($z > 0) : $divider = " column_separator"; endif; ?>
				<?php
				$rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns'));
				$cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns'));
				?>
					<td valign="top"
						width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%"
						class="article_column<?php echo $divider ?>">
						<?php
						$loop = (($z < $cols)?1:0) + $rows;

						for ($y = 0; $y < $loop; $y ++) :
							$target = $i + ($y * $this->params->get('num_columns')) + $z;
							if ($target < $this->total && $target < ($numIntroArticles)) :
								$this->item =& $this->getItem($target, $this->params);
								echo $this->loadTemplate('item');
							endif;
						endfor;
						?></td>
						<?php endfor; 
						$i = $i + $this->params->get('num_intro_articles', 4) ; 
			else : // otherwise, order down, same as before (default behaviour)
				for ($z = 0; $z < $this->params->get('num_columns'); $z ++) :
				if ($z > 0) : $divider = " column_separator"; endif; ?>
				<td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
				<?php for ($y = 0; $y < ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); $y ++) :
					if ($i < $this->total && $i < ($numIntroArticles)) :
						$this->item =& $this->getItem($i, $this->params);
						echo $this->loadTemplate('item');
						$i ++;
	           endif;
	      endfor; ?>
	</td>
        <?php 
        endfor; 
endif; ?>

Initial URL

                                

Initial Description

                                

Initial Title
Joomla 1.5 - Blog Loop

Initial Tags
php, joomla

Initial Language
PHP