本文整理汇总了PHP中Pages::findRootParentModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::findRootParentModel方法的具体用法?PHP Pages::findRootParentModel怎么用?PHP Pages::findRootParentModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::findRootParentModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<?php
$parent_page = Pages::findRootParentModel($page_id);
$listchild = Pages::findChildOfPages($page_id);
if (!empty($parent_page) && $parent_page->slug != $_GET['slug'] || !empty($listchild)) {
$child_page = Pages::findChildOfPages($parent_page->id);
?>
<!-- box -->
<div class="box-1">
<div class="title"><h3><?php
echo $parent_page->title;
?>
</h3></div>
<div class="content">
<ul class="nav-list">
<?php
if (!empty($child_page)) {
foreach ($child_page as $item) {
if ($item->external_link != "") {
$href = $item->external_link;
} else {
$href = Yii::app()->createAbsoluteUrl("page/index", array('slug' => $item->slug));
// $href = Yii::app()->createAbsoluteUrl("page".$item->slug);??? ai code
}
$class_li = "";
if ($_GET['slug'] == $item->slug) {
$class_li .= "active";
}
?>
<li class="<?php
echo $class_li;
示例2: array
include_once 'head.php';
?>
<body>
<!-- header -->
<?php
include_once 'header.php';
?>
<?php
//HTram
if (Yii::app()->controller->id == 'site' && Yii::app()->controller->action->id == 'index') {
?>
<div class="wrapper breadcrumb"></div>
<?php
} else {
$this->breadcrumbs = array(array('controller' => Yii::app()->controller->id, 'action' => Yii::app()->controller->action->id));
if (isset($this->breadcrumbs)) {
foreach ($this->breadcrumbs as $item) {
if ($item['controller'] == 'page') {
if (isset($_GET['slug']) && $_GET['slug'] != "") {
$page = Pages::findBySlug($_GET['slug']);
$page_root = array();
if ($page->parent_id != 0) {
$page_root = Pages::findRootParentModel($page->parent_id);
}
if ($page_root) {
$name_breadcrum = '<a href="' . Yii::app()->createAbsoluteUrl('page/index', array('slug' => $page_root->slug)) . '">' . $page_root->title . "</a> » <strong>" . $page->title . "</strong>";
} else {