2011-09-08 36 views
0

我有這樣的代碼在listmatchesSuccess.php:爲什麼我越來越:調用未定義的方法sfPHPView :: getRequestParameter?

$matching_rows = RcProfileTablePeer::getAllBySelection($gender_id1,$gender_id2,$age1,$age2,$province_id); 
$pager = new sfPropelPager('RcProfileTable', 10); 
$pager->setCriteria($matching_rows); 
$pager->setPage($this->getRequestParameter('page', 1)); 
$pager->init(); 
在我的actions.class.php

我剛纔的功能:

public function executeListmatches(sfWebRequest $request) 
{ 

} 

我只是想列出所有的行,我的搜索匹配這是我在主頁上選擇的標準,我打那麼一下按鈕,得到listmatches頁

在_login.php提交按鈕調用:

<form action="<?php echo url_for('password/listmatches?page='."1") ?>" method="post" > 

是因爲我的actions.class中沒有這些傳呼機行嗎? 請幫忙? 謝謝

+0

'$ this'指的是當前類。該類內的代碼(listmatchesSuccess.php)? – feeela

+0

根據http://www.symfony-project.org/api/1_4/sfPHPView,沒有稱爲「getRequestParameter」的方法。 – Javaguru

+0

噢喲相當正確..沒有它..我不知道在哪裏放置尋呼機的代碼,因爲頁面從部分_login.php通過表單動作調用...任何建議請?謝謝 –

回答

0

你爲什麼把頁面代碼放在你的視圖(listmatchesSuccess.php)中?它屬於行動。我強烈建議做實用的Symfony教程瞭解MVC模式:

Jobeet Tutorial

的$這個 - > getRequestParameter()是sfAction類的方法,所以你不能在視圖,它是從下降使用sfView類。再次 - 你的尋呼機代碼屬於actions.class.php。

這是一個關於在symfony中分頁的教程。它是爲1.2版本製作的,但它會做得很好。

Pagination tutorial

相關問題