本文整理匯總了PHP中SearchForm::setPageLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchForm::setPageLength方法的具體用法?PHP SearchForm::setPageLength怎麽用?PHP SearchForm::setPageLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SearchForm
的用法示例。
在下文中一共展示了SearchForm::setPageLength方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SearchPlusForm
function SearchPlusForm($name = "SearchForm", $fieldName = "Search", $fieldLabel = '')
{
$action = $this->getRequest()->param("Action");
$page = SearchPlusPage::get()->first();
if ($page) {
//!in_array($action, array("login", "logout")) &&
if (!$fieldLabel) {
if (isset($_REQUEST[$fieldName])) {
$searchText = $_REQUEST[$fieldName];
//we set $_REQUEST["Search"] below because it is also used by things like Text::ContextSummary
$_REQUEST["Search"] = $_REQUEST[$fieldName];
} elseif (isset($_REQUEST["Search"])) {
$searchText = $_REQUEST["Search"];
} else {
$searchText = 'Search';
}
} else {
$searchText = '';
}
$field = new TextField($fieldName, $fieldLabel, $searchText);
$fields = new FieldList($field);
$actions = new FieldList(new FormAction('results', 'Search'));
$form = new SearchForm($this, $name, $fields, $actions);
$form->setFormAction($page->Link() . "results/");
$form->setPageLength(Config::inst()->get("SearchPlusPage", "result_length"));
$form->unsetValidator();
return $form;
} elseif (!$page) {
user_error("You need to create a SearchPlusPage to have a search box", E_USER_NOTICE);
}
}