....
<!-- First page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->first, 'software_id' => $this->software_id)); ?>">First</a> |
<?php else: ?>
<span class="disabled">First</span> |
<?php endif; ?>
....
etc...
As a side note: What I do in my systems is instead of having a long list of query strings to maintain, create an object (mine typically follow the Specification pattern to define a model view) that can be serialized and put into the session. I then simply md5(serialize()) the instance to get a UID which I pass as the sole parameter.
As a simple example:
$myVO = new QueryStringVO;
$myVO->software_id = 15;
$myVO->release_id = 'Final';
....
$uid = My_Session::persist($myVO); //uid obtained by md5(serialize($myVO));
... <In a View Script> ...
$this->url(array('spec' => $uid));
And for the next request:
$uid = $this->_getParam('spec');
$myVO = My_Session::retrieve($uid)
echo $myVO->software_id; //15
This means you can add any information you like without having to keep going into the view scripts to ensure those parameters are passed around.
Kind Regards,
Daniel Skinner
Gabriel Baez wrote:
it's getting populated, hmm this is what I have right now straight from the docs samples
<!--
See http://developer.yahoo.com/ypatterns/pattern.php?pattern=itempagination
-->
<?php if ($this->pageCount): ?>
<div class="paginationControl">
<?= $this->firstItemNumber; ?> - <?= $this->lastItemNumber; ?>
of <?= $this->totalItemCount; ?>
<!-- First page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->first)); ?>">First</a> |
<?php else: ?>
<span class="disabled">First</span> |
<?php endif; ?>
<!-- Previous page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->previous)); ?>">< Previous</a> |
<?php else: ?>
<span class="disabled">< Previous</span> |
<?php endif; ?>
<!-- Next page link -->
<?php if (isset($this->next)): ?>
<a href="<?= $this->url(array('page' => $this->next)); ?>">Next ></a> |
<?php else: ?>
<span class="disabled">Next ></span> |
<?php endif; ?>
<!-- Last page link -->
<?php if (isset($this->next)): ?>
<a href="<?= $this->url(array('page' => $this->last)); ?>">Last</a>
<?php else: ?>
<span class="disabled">Last</span>
<?php endif; ?>
</div>
<?php endif; ?>
On Wed, Oct 1, 2008 at 8:57 AM, Daniel Skinner <skinner@destiny-denied.co.uk> wrote:
What does the code in page.phtml look like?
As a quick test I would do a <?php echo $this->software_id; ?> in your main view script to ensure the variable is populated by the controller. Then do exactly the same in page.phtml to ensure that it is being passed through to the partial.
Kind Regards,
*Daniel Skinner*
Gabriel Baez wrote:
I'm not getting any errors which is weird, I attached a screen shot so you can see how it looks like, especially when I put my mouse over the pagination link.
Did yours work fine? I'm using zend 1.6.1
On Wed, Oct 1, 2008 at 8:37 AM, Daniel Skinner <skinner@destiny-denied.co.uk <mailto:skinner@destiny-denied.co.uk>> wrote:
Are you getting any errors? Does the pagination control
('page.phtml') display any static markup?
Kind Regards,
*Daniel Skinner*
Gabriel Baez wrote:
I tried this on the view script: <?php echo
$this->paginationControl($this->paginator, 'Sliding',
'page.phtml',array('software_id' =>
$this->software_id,'release_id' =>
$this->release_id,'doc_type' => $this->doc_type)); ?> don't seem to be having much luck!
this is what I'm doing on the controller, any ideas?
public function relnoteindexAction()
{
try {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()):
$this->view->identity = $auth->getIdentity();
$email = $auth->getIdentity();
$id = $this->user->getuserid($email);
$role = $this->user->checkrole($id); if($this->acl->isAllowed($role, 'admin','relnoteindex')):
$form = new DocIndexForm();
$this->view->form = $form; if($this->getRequest()->isGet()):
$formData = $this->getRequest()->getParams();
if($form->isValid($formData)):
$page =
Zend_Filter::get($this->getRequest()->get('page'),'StripTags');
$software_id =
Zend_Filter::get($this->getRequest()->get('software_id'),'StripTags');
$release_id =
Zend_Filter::get($this->getRequest()->get('release_id'),'StripTags');
$doc_type =
Zend_Filter::get($this->getRequest()->get('document_id'),'StripTags');
$this->view->software_id =
$software_id;
$this->view->release_id = $release_id;
$this->view->doc_type = $doc_type;
$itemsPerPage = 1;
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$select = $this->db->select()
->from(array('p'
=>'SOFTWARE_DOCUMENTS_VW'),
array('ID AS
DOCID','TITLE','CREATED_BY','CREATION_DATE','LAST_UPDATE','SOFTWARE_ID','SOFTWARE_NAME',
'RELEASE_ID','RELEASE_NAME','DOC_TYPE_ID','DOC_NAME','COMPANY_ID','COMPANY_NAME','PUBLISHED',
'LOCKED_STATUS','LOCKED_BY','LOCKED_DATE')) ->where('p.SOFTWARE_ID = ?',$software_id)
->where('p.DOC_TYPE_ID = ?',
$doc_type)
->where('p.RELEASE_ID=
?',$release_id); $rows =
$this->db->fetchAll($select); $paginator = Zend_Paginator::factory($rows); $paginator->setItemCountPerPage($itemsPerPage);
$paginator->setCurrentPageNumber($page);
$this->view->paginator = $paginator;
else:
$form->populate($formData); endif;
endif; else:
$this->render('insufficient-permissions'); endif; elseif (!$auth->hasIdentity()):
$this->_redirect('/register');
endif;
}
catch (Exception $e)
{
$msg = $e->getMessage();
$this->log->info("Controller: Administrator Action:
relnoteindex Error: $msg" ); $this->render('error');
}
}
On Tue, Sep 30, 2008 at 7:21 PM, Gabriel Baez
<sheik316@gmail.com <mailto:sheik316@gmail.com>
<mailto:sheik316@gmail.com <mailto:sheik316@gmail.com>>> wrote:
Yea I looked on the docs and didn't see it, thanks for
the info.
On Tue, Sep 30, 2008 at 5:00 PM, Daniel Skinner
<skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
http://framework.zend.com/issues/browse/ZF-4430
Kind Regards,
*Daniel Skinner*
Daniel Skinner wrote:
In your view script:
<?php echo $this->paginationControl($this->paginator,
'Sliding', 'pagination_control.phtml',
array('specification' =>
$this->currentSpecificationUID)); ?>
The method signature is:
paginationControl(Zend_Paginator $paginator,
$paginationType, $paginationPartialScript, Array
$partialParameters = array);
So In my above example I passed the 'specification'
parameter and it's available in the pagination control
partial as $this->specification.
I think this should be noted in the documentation on
Zend_Paginator somewhere. Shall I create an issue?
Kind Regards,
*Daniel Skinner*
*Tel:* 01977 87 80 22
*Fax:* 08455 08 36 15
*Mobile:* 07791 360 230
skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>
www.destiny-denied.co.uk
<http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk/>
Gabriel Baez wrote:
Could you give an example on how you would
pass the
search parameters to the pagination control helper?
thanks.
On Sun, Sep 28, 2008 at 4:28 AM, Daniel Skinner
<skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>> wrote:
Thanks Matt, I didn't realise that you could
pass
parameters to
the PaginationControl partial - I should have
looked at the API
docs in more detail.
Daniel
Matthew Ratzloff wrote:
One way to do it:
1. Submit form as GET
2. Controller looks at Request object to
pull
appropriate
search parameters
2. Uses search parameters to create SQL
query,
which it
passes to paginator
3. Passes paginator and search parameters
(including current
page number) to PaginationControl helper
-Matt
On Wed, Sep 24, 2008 at 2:39 PM, Daniel
Skinner
<skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>
<http://www.destiny-denied.co.uk/><mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>>> wrote:
I am using Zend_Paginator in a very
standard
setup.
My index action of the controller
produces a
form. Also,
if the
form is filled in (i.e. is valid), it
(the
same index action)
proceeds to generate a collection of
objects
filtered by
information entered into the form. This
collection of
objects in
then paginated and all is well for
the first
page of results.
When I click onto the next page, the form
data is not sent
and so
there is no model for the paginator
to work
with.
My immediate idea was to add an
additional
parameter to the
first/next/last/prev links which could be
used to
regenerate the
same model as the paginator was using
with
page 1.
The problem is that the pagination
control
is a partial
and I cant
figure out how to pass global view
variables
to it.
Is there a way to do this or is my
general
approach (i.e.
adding
query strings to the paginator URI's)
wrong?
--
Kind Regards,
*Daniel Skinner*
*Tel:* 01977 87 80 22
*Fax:* 08455 08 36 15
*Mobile:* 07791 360 230
skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>
<mailto:skinner@destiny-denied.co.uk
<mailto:skinner@destiny-denied.co.uk>>>>>
www.destiny-denied.co.uk
<http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk>
<http://www.destiny-denied.co.uk>
------------------------------------------------------------------------
没有评论:
发表评论