本文整理汇总了PHP中Concrete\Core\Page\Page::loadError方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::loadError方法的具体用法?PHP Page::loadError怎么用?PHP Page::loadError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Concrete\Core\Page\Page
的用法示例。
在下文中一共展示了Page::loadError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFromRequest
/**
* Uses a Request object to determine which page to load. queries by path and then
* by cID
*/
public static function getFromRequest(Request $request)
{
// if something has already set a page object, we return it
$c = $request->getCurrentPage();
if (is_object($c)) {
return $c;
}
if ($request->getPath() != '') {
$path = $request->getPath();
$r = array();
$db = Loader::db();
$cID = false;
while (!$cID && $path) {
$cID = $db->GetOne('select cID from PagePaths where cPath = ?', array($path));
if ($cID) {
$cPath = $path;
break;
}
$path = substr($path, 0, strrpos($path, '/'));
}
if ($cID && $cPath) {
$c = Page::getByID($cID, 'ACTIVE');
} else {
$c = new Page();
$c->loadError(COLLECTION_NOT_FOUND);
}
return $c;
} else {
$cID = $request->query->get('cID');
if (!$cID) {
$cID = $request->request->get('cID');
}
$cID = Loader::helper('security')->sanitizeInt($cID);
if (!$cID) {
$cID = 1;
}
$c = Page::getByID($cID, 'ACTIVE');
}
return $c;
}
示例2: getFromRequest
/**
* Uses a Request object to determine which page to load. queries by path and then
* by cID.
*/
public static function getFromRequest(Request $request)
{
// if something has already set a page object, we return it
$c = $request->getCurrentPage();
if (is_object($c)) {
return $c;
}
if ($request->getPath() != '') {
$path = $request->getPath();
$db = Database::get();
$cID = false;
$ppIsCanonical = false;
while (!$cID && $path) {
$row = $db->GetRow('select cID, ppIsCanonical from PagePaths where cPath = ?', array($path));
if (!empty($row)) {
$cID = $row['cID'];
if ($cID) {
$cPath = $path;
$ppIsCanonical = (bool) $row['ppIsCanonical'];
break;
}
}
$path = substr($path, 0, strrpos($path, '/'));
}
if ($cID && $cPath) {
$c = Page::getByID($cID, 'ACTIVE');
$c->cPathFetchIsCanonical = $ppIsCanonical;
} else {
$c = new Page();
$c->loadError(COLLECTION_NOT_FOUND);
}
return $c;
} else {
$cID = $request->query->get('cID');
if (!$cID) {
$cID = $request->request->get('cID');
}
$cID = Core::make('helper/security')->sanitizeInt($cID);
if (!$cID) {
$cID = 1;
}
$c = Page::getByID($cID, 'ACTIVE');
$c->cPathFetchIsCanonical = true;
}
return $c;
}
示例3: loadError
public function loadError($error)
{
return parent::loadError($error);
}