On Sun, Mar 8, 2009 at 3:37 AM, mapes911 <[email protected]> wrote:
>
> hi all,
>
> i have pagination set up on a set of data and all works fine. but i am
> trying to add some ajax functionality to my page reloads and i've run
> across
> a problem.
>
> i have this code in my pagination.phtml
> <?php if ($this->pageCount): ?>
> <div class="paginationControl">
> <!-- Previous page link -->
> <?php if (isset($this->previous)): ?>
> "javascript:ajaxReLoadCommentWall('<?php echo $this- id;?>','<?php echo
> $this->previous;?>');">Previous |
> <?php endif; ?>
>
> <!-- Numbered page links -->
> <?php foreach ($this->pagesInRange as $page): ?>
> <?php if ($page != $this->current): ?>
> "javascript:ajaxReLoadCommentWall('<?php echo $this- id;?>','<?php echo
> $page;?>');"><?php echo $page; ?> |
> <?php else: ?>
> <?php echo $page; ?> |
> <?php endif; ?>
> <?php endforeach; ?>
>
> <!-- Next page link -->
> <?php if (isset($this->next)): ?>
> "javascript:ajaxReLoadCommentWall('<?php echo $this- id;?>','<?php echo
> $this->next;?>');">Next
> <?php endif; ?>
> </div>
> <?php endif; ?>
>
> my problem is that i have no idea how to assign the variable $this->id in
> the controller or the model or anywhere for that matter!
>
> my first thought was that there might be a way to attach some data to the
> paginator within the model where it is setup.
>
> this is the code i have there...
>
> $postsAndUsers = PWallPosts::fetchPostsAndUsers($id);
>
> $paginator = Zend_Paginator::factory($postsAndUsers);
> $paginator->setItemCountPerPage($count);
> $paginator->setCurrentPageNumber($page);
> $paginator->setPageRange($pageRange);
>
> Zend_Paginator::setDefaultScrollingStyle('Elastic');
>
>
> Zend_View_Helper_PaginationControl::setDefaultViewPartial('proposal/pagination.phtml');
>
> can i somehow attach the $id to paginator?
>
> i also tried assigning this id to the view when i setup my controller. but
> the view information is not available in the pagination.phtml because it's
> a
> partial right?
>
> anyway, i'm confused now and i'm sure there is a simple way to pass this id
> into my phtml script somehow.. but i don't see it.. perhaps its time for
> bed
> :)
>
Just a thought: rethink your Javascript function so that it does not
require $this->id to be passed in at all.
Use php to "hard-code" the id into the javascript either as a global or as
local function variable.
var id = <?php echo $this->id?>;
function ajaxReLoadCommentWall(pageNum) {
/// do your thing
}
--
David Mintz
http://davidmintz.org/
The subtle source is clear and bright
The tributary streams flow through the darkness