本文整理汇总了PHP中RequestHandler::getPage方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::getPage方法的具体用法?PHP RequestHandler::getPage怎么用?PHP RequestHandler::getPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::getPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillMenu
/**
* recursive fill the menu.
*
* @param string $lbl
* @param array $page
* @param string $class
* @access private
* @return DomElement
*/
private function fillMenu($lbl, $page, $class = null)
{
if ($class === null) {
$rq = new RequestHandler(DEFAULTPAGE, $this->basepath);
}
if (is_array($page)) {
if (isset($page['default'])) {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page['default']);
if ($class === null && $rq->getPage() == $page['default']) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
unset($page['default']);
} else {
$li = $this->document->createElement('li', $lbl);
}
if (count($page) > 0) {
$subList = $this->document->createElement('ul');
if (!empty($class)) {
$subList->setAttribute('class', 'sub');
} else {
$subList->setAttribute('class', 'sub first');
}
foreach ($page as $slbl => $spage) {
$subList->appendChild($this->fillMenu($slbl, $spage, 'sub'));
}
$li->appendChild($subList);
}
return $li;
} else {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page);
if ($class === null && $rq->getPage() == $page) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
return $li;
}
}
示例2: beforeContent
/**
* build menu before content
*
* @access public
* @return void
*/
public function beforeContent()
{
$menu = $this->document->getElementById($this->id);
if ($menu) {
$this->document->addCss('public/css/simplemenu.css');
$menu->removeAttribute('style');
$menuList = $this->document->createElement('ul');
$rq = new RequestHandler(DEFAULTPAGE, $this->basepath);
foreach ($this->menuItems as $lbl => $page) {
$li = $this->document->createElement('li');
$a = $this->document->createElement('a', $lbl);
$a->setAttribute('href', $this->basepath . '/' . $page);
if ($rq->getPage() == $page) {
$li->setAttribute('class', 'selected');
}
$li->appendChild($a);
$menuList->appendChild($li);
}
$menu->appendChild($menuList);
}
}
示例3: run
/**
* default page run.
* all is controlled by thisone (well thisone is called from __toString)
*
* @access private
* @return void
*/
private function run()
{
/* onentry modules */
$this->runModules('onEntry');
$rq = new RequestHandler($this->defaultPage, $this->basepath);
/* beforeContent modules */
$this->runModules('beforeContent');
$page = null;
$classname = "Pages_" . ucfirst($rq->getPage());
if (class_exists($classname) && Acl::acl()->isAllowed($rq->getPage())) {
$page = new $classname($this->document, $this->toArray());
if (!$page instanceof IPages) {
throw new Exception('the page doesnt implement the page interface');
}
if ($rq->getParameters() != null) {
$page->setParameters($rq->getParameters());
}
if ($rq->getAction() != null && method_exists($page, $rq->getAction())) {
$action = $rq->getAction();
$page->{$action}();
} else {
$page->index();
}
} else {
$page = new Pages_404($this->document, $this->toArray());
$page->index();
}
/* afterContent modules */
$this->runModules('afterContent');
/* onExit modules */
$this->runModules('onExit');
}