Advertisement
demlasjr

pagination

Oct 5th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.78 KB | None | 0 0
  1. <?php
  2. defined('_JEXEC') or die('Restricted access'); // no direct access
  3. require_once dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');
  4. ?>
  5. <?php $cparams =& JComponentHelper::getParams('com_media'); ?>
  6.  
  7. <?php ob_start(); ?>
  8. <?php if ($this->params->def('show_description', 1) || $this->params->def('show_description_image', 1)) :?>
  9. <table class="blog<?php echo $this->params->get('pageclass_sfx');?>" cellpadding="0" cellspacing="0" width="100%">
  10. <tr>
  11.     <td valign="top">
  12.     <?php if ($this->params->get('show_description_image') && $this->category->image) : ?>
  13.         <img src="<?php echo $this->baseurl . '/' . $cparams->get('image_path') . '/'. $this->category->image;?>" align="<?php echo $this->category->image_position;?>" hspace="6" alt="" />
  14.     <?php endif; ?>
  15.     <?php if ($this->params->get('show_description') && $this->category->description) : ?>
  16.         <?php echo $this->category->description; ?>
  17.     <?php endif; ?>
  18.     </td>
  19. </tr>
  20. </table>
  21. <?php endif; ?>
  22. <?php echo artxPost(artxPageTitle($this), ob_get_clean()); ?>
  23.  
  24. <table class="blog<?php echo $this->params->get('pageclass_sfx');?>" cellpadding="0" cellspacing="0" width="100%">
  25. <?php if ($this->params->get('num_leading_articles')) : ?>
  26. <tr>
  27.     <td valign="top">
  28.     <?php for ($i = $this->pagination->limitstart; $i < ($this->pagination->limitstart + $this->params->get('num_leading_articles')); $i++) : ?>
  29.         <?php if ($i >= $this->total) : break; endif; ?>
  30.         <div>
  31.         <?php
  32.             $this->item =& $this->getItem($i, $this->params);
  33.             echo $this->loadTemplate('item');
  34.         ?>
  35.         </div>
  36.     <?php endfor; ?>
  37.     </td>
  38. </tr>
  39. <?php else : $i = $this->pagination->limitstart; endif; ?>
  40.  
  41. <?php
  42. $startIntroArticles = $this->pagination->limitstart + $this->params->get('num_leading_articles');
  43. $numIntroArticles = $startIntroArticles + $this->params->get('num_intro_articles');
  44. if (($numIntroArticles != $startIntroArticles) && ($i < $this->total)) : ?>
  45. <tr>
  46.     <td valign="top">
  47.         <table width="100%" cellpadding="0" cellspacing="0">
  48.         <tr>
  49.         <?php
  50.             $divider = '';
  51.             if ($this->params->get('multi_column_order')) : // order across, like front page
  52.                 for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) :
  53.                     if ($z > 0) : $divider = " column_separator"; endif; ?>
  54.                     <?php
  55.                     $rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns'));
  56.                     $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns'));
  57.                     ?>
  58.                     <td valign="top"
  59.                         width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%"
  60.                         class="article_column<?php echo $divider ?>">
  61.                         <?php
  62.                         $loop = (($z < $cols)?1:0) + $rows;
  63.                         $i = 1;
  64.                         for ($y = 0; $y < $loop; $y ++) :
  65.                             $target = $i + ($y * $this->params->get('num_columns')) + $z;
  66.                             if ($target < $this->total && $target < ($numIntroArticles)) :
  67.                                 $this->item =& $this->getItem($target, $this->params);
  68.                                 echo $this->loadTemplate('item');
  69.                             endif;
  70.                         endfor;
  71.                         ?></td>
  72.                 <?php endfor;
  73.                         $i = $i + $this->params->get('num_intro_articles') ;
  74.             else : // otherwise, order down, same as before (default behaviour)
  75.                 for ($z = 0; $z < $this->params->get('num_columns'); $z ++) :
  76.                     if ($z > 0) : $divider = " column_separator"; endif; ?>
  77.                     <td valign="top" width="<?php echo intval(100 / $this->params->get('num_columns')) ?>%" class="article_column<?php echo $divider ?>">
  78.                     <?php for ($y = 0; $y < ($this->params->get('num_intro_articles') / $this->params->get('num_columns')); $y ++) :
  79.                     if ($i < $this->total && $i < ($numIntroArticles)) :
  80.                         $this->item =& $this->getItem($i, $this->params);
  81.                         echo $this->loadTemplate('item');
  82.                         $i ++;
  83.                     endif;
  84.                 endfor;?>
  85.                 </td>
  86.         <?php endfor;
  87.         endif; ?>
  88.         </tr>
  89.         </table>
  90.     </td>
  91. </tr>
  92. <?php endif; ?>
  93. </table>
  94. <?php if ($this->params->get('num_links') && ($i < $this->total)) : ?>
  95. <?php ob_start(); ?>
  96. <?php
  97.     $this->links = array_splice($this->items, $i - $this->pagination->limitstart);
  98.     echo $this->loadTemplate('links');
  99. ?>
  100. <?php echo artxPost(null, ob_get_clean()); ?>
  101. <?php endif; ?>
  102. <?php
  103. $paginationPagesLinks = $this->params->get('show_pagination')
  104.     ? $this->pagination->getPagesLinks() : '';
  105. $paginationPagesCounter = $this->params->get('show_pagination_results')
  106.     ? $this->pagination->getPagesCounter() : '';
  107. ?>
  108. <?php if (strlen($paginationPagesLinks) > 0 && strlen($paginationPagesCounter) > 0) : ?>
  109. <?php ob_start(); ?>
  110. <div id="navigation">
  111. <?php if (strlen($paginationPagesLinks) > 0) : ?>
  112. <p><?php echo $paginationPagesLinks; ?></p>
  113. <?php endif; ?>
  114. <?php if (strlen($paginationPagesCounter) > 0) : ?>
  115. <p><?php echo $paginationPagesCounter; ?></p>
  116. <?php endif; ?>
  117. </div>
  118. <?php echo artxPost(null, ob_get_clean()); ?>
  119. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement