Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down
4

by tchek tchek in Coding about April 19, 2016 open - report

how to do pagination ??

Hello all,

I don't know how to do pagination on SE 4.8.10. 

-  this is my section paginator of Controller.php :

 

$table = Engine_Api::_()->getDbtable('users', 'user');
$select = $table->select()
->where('search = ?', 1)
->where('enabled = ?', 1)
->where('displayname not like "test%"')
;


$paginator = Zend_Paginator::factory($select);
$paginator->setItemCountPerPage(50);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;

-  this is my views/script pagination.phtml :

<div class="pagination" style="width:100%">

<div style="float:left;width:28%">
</div>
<div style="float:right;width:70%;">
<!-- First page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->first)); ?>">Start</a> |
<?php else: ?>
<span class="disabled">Start</span> |
<?php endif; ?>

<!-- Previous page link -->

<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->previous)); ?>">&lt; Previous</a> |
<?php else: ?>
<span class="disabled">&lt; Previous</span> |
<?php endif; ?>
<!-- Numbered page links -->
<?php foreach ($this->pagesInRange as $page): ?>
<?php if ($page != $this->current): ?>
<a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a>
<?php else: ?>
<?= $page; ?>
<?php endif; ?>
<?php endforeach; ?>
<!-- Next page link -->
<?php if (isset($this->next)): ?>
| <a href="<?= $this->url(array('page' => $this->next)); ?>">Next &gt;</a> |
<?php else: ?>
| <span class="disabled">Next &gt;</span> |
<?php endif; ?>
<!-- Last page link -->
<?php if (isset($this->next)): ?>
<a href="<?= $this->url(array('page' => $this->last)); ?>">End</a>
<?php else: ?>
<span class="disabled">End</span>
<?php endif; ?>
&nbsp; Page <?= $this->current; ?> of <?= $this->last; ?>
</div>
</div>

- this is my section on index.tpl :

<?php $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>

but when I do this nothing appear. can you help me please ? 

Thanks in advance ;)

Answers: 0  •  Score 0  •  Views: 782

No answers yet. Be the first!
You must login to post an answer.