Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: None  |  size: 2.32 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public function executeCatalogue(sfWebRequest $request)
  2.         {
  3.                
  4.                 $resultsPerPage = 5;
  5.                 $this->nodeArray = $this->getNodeArray();
  6.                 $param = $request->getParameter('node');
  7.                
  8.                 if (($param != null )&&($param != ''))
  9.                 {
  10.                         $this->node = Doctrine::getTable('Node')->findOneBySlug($param);
  11.                         $this->nodeid = $this->node->getId(); // для проверки
  12.                         $this->id_nodes = Doctrine::getTable('Item_cost')->findOneByNodeId($this->node->getId());
  13.                        
  14.                         $this->Item = $this->node->getItem();
  15.                         $currentPage = $param;
  16.                         // pager
  17.                         try {
  18.  
  19.                     $this->pager = new Doctrine_Pager(
  20.                       Doctrine_Query::create()
  21.                             ->select('a.*')
  22.                                         ->from('Item a')
  23.                                         ->where('a.id = ?',$this->id_nodes->getItemId()),
  24.                                 $currentPage, $resultsPerPage);
  25.                     $error = $this->pager;
  26.                     }
  27.                         catch (Exception $error){
  28.                        
  29.                     }  
  30.                 }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.        
  39.    
  40.                     <?php $Item = $pager->execute($args = array());?>                                          
  41.                                <?php if ($pager->haveToPaginate())  { ?>       
  42.                         <div id="goPage">
  43.                                 Страница
  44.                                 <span class="control">
  45.                                        <a href="<?php echo $node->getSlug()?>/page/<?php echo $pager->getPreviousPage() ?>"><img src="/images/back.jpg"></a>
  46.                                            <span class="current_page"><?php echo $pager->getPage(); ?>
  47.                                            <a href="<?php echo $node->getSlug()?>/page/<?php echo $pager->getNextPage() ?>"><img src="/images/forward.jpg"></a>
  48.                                     </span>
  49.                                 из &nbsp; <strong><?php echo $pager->getLastPage(); ?></strong>
  50.                         </div>
  51.                         <?php } ?>
  52.                        
  53.                         <?php foreach ($Item as $items): ?>
  54.                         <?php echo $items; //проверка?>
  55.                         <?php endforeach; ?>
  56.                        
  57.         <div class="bredcrumbs">
  58.             // <span class="first"><?php echo sprintf( "<a href=\"%s\">%s</a>", urldecode(url_for('@catalogue_node?node='.$node->getSlug())), $node->getTitle()) ?></span>
  59.             / <span>в рубрике (<?php echo $Item->Count()?>)</span>
  60.          
  61.          
  62.         </div>
  63.        
  64.     </div>
  65.  
  66.          <?php //foreach ($Item as $items): ?>
  67.          <?php include_partial('main/itemCatalogue', array('item' => $Item)) ?>
  68.     <?php //include_partial('main/itemCatalogue', array('item' => $Item)) ?>
  69.         <?php //endforeach; ?>