symfony 分页

  public function executeShow(sfWebRequest $request)
  {
    $this->category = Doctrine_Core::getTable('Category')->find(array($request->getParameter('id')));
    $this->forward404Unless($this->category);

    $this->pager=new sfDoctrinePager('Content', 1);
    $q=Doctrine::getTable('Content')
    ->createQuery('c')
    ->where('c.category_id=?',array($this->category->getId()));
    $this->pager->setQuery($q);
    if($request->getParameter('page'))
    {
		$this->pager->setPage($request->getParameter('page'));

    }
    $this->pager->init();
  }

 

< ?php foreach($pager->getResults() as $record):?>*   < ?php echo $record->getTitle();?>
updatedupdated2021-03-182021-03-18