logo

This is an old version of this question!

Return to the current question

$5
Symfony 1.4, Pager Navigation, additional URL parameters

I'd like to create a pageable blog archive like this:

blog_archive:
url: /blog/archive/:year/:month/:page
class: sfDoctrineRoute
options: { model: Blog, type: list }
param: { module: blog, action: listArchive, page: 1 }
requirements:
year: \d+
month: \d+
sf_method: [get, post]


This works fine, creating including the pager:


public function executeListArchive(sfWebRequest $request) {
...
$this->pager = ReviewTable::getInstance()->getArchivePager($page, $this->hitsperpage, $this->year, $this->month);


However, if I add the pager_navigation() to the Template like this:
<?php echo pager_navigation($pager, 'blog_archive') ?>
, I get an error message like "The "/blog/archive/:year/:month/:page" route has some missing mandatory parameters (:year, :month)." If I change the code to
<?php echo pager_navigation($pager, '@blog_archive?year='.$year.'&month='.$month) ?>
, the Pager doesn't work, because the page parameter isn't added to the URL.

sn | 12/20/11 at 11:26am

This is an old version of this question!

Return to the current question