上不工作我已經定義在page.php文件一個文件searchformSilverstripe - 通用搜索表單安全性/登錄頁
功能AdvancedSearchForm(){$ = SEARCHTEXT isset($這個 - >查詢)? $ this-> Query:'Search'; $ searchText2 = isset($ this-> Subquery)? $ this-> Subquery:'0'; $ searchText3 = isset($ this-> documentType)? $ this-> documentType:'All';
$searchSections = DataObject::get('SearchSection');
$ss = array();
foreach ($searchSections as $section) {
$ss[$section->ID] = $section->Name;
}
$fileTypes = DataObject::get('FileType');
$ft = array();
foreach ($fileTypes as $type) {
$ft[$type->ID] = $type->Name;
}
$ft[0] = 'All';
ksort($ft);
$fields = new FieldSet(
new TextField('Query','Keywords', $searchText),
new DropdownField('Subquery', '', $ss, $searchText2),
new DropdownField('documentType', '', $ft, $searchText3)
);
$actions = new FieldSet(
new FormAction('AdvancedSearchResults', 'Search')
);
$form = new Form($this->owner, 'AdvancedSearchForm', $fields, $actions);
$form->setFormMethod('GET');
$form->setTemplate('Includes/SearchForm');
$form->disableSecurityToken();
return $form;
}
和我所有的網頁都從頁擴展和搜索的形式是在標題中,會出現在所有頁面上。但是,當用戶在安全/登錄頁面上,並試圖尋找的東西,他得到了以下錯誤消息
The action 'AdvancedSearchForm' does not exist in class Security
我想這樣做的原因是安全網頁無法從頁擴展。我如何設置搜索以便它可以在任何頁面上工作,包括系統頁面,例如安全登錄頁面?
這樣做的伎倆!非常感謝你。 – Optimus 2011-05-31 14:57:39
雖然 – Optimus 2011-05-31 14:58:02
糟糕,我必須將'ModelController'更改爲'ModelAsController'糟糕...是的,你是對的!很高興工作! – blu42media 2011-05-31 16:38:48