public function parseUrl($manager, $request, $pathInfo, $rawPathInfo) { $alias = Yii::app()->cms->currentAlias; if (isset($alias)) { if (($cache = Yii::app()->cache->get('parseUrl-content_' . $alias->id)) !== false) { $requestPath = $request->getPathInfo(); $afterRoute = substr($requestPath, strpos($requestPath, $alias->alias) + strlen($alias->alias)); return $cache . '/' . trim($afterRoute, '/'); } else { foreach ($alias->routes as $route) { if ($route->route == 'content') { $pageModel = ContentPage::model()->findByAttributes(array('alias_id' => $alias->id)); $return = 'content/default/index/id/' . $pageModel->id; Yii::app()->cache->set('parseUrl-content_' . $alias->id, $return); $requestPath = $request->getPathInfo(); $afterRoute = substr($requestPath, strpos($requestPath, $alias->alias) + strlen($alias->alias)); return $return . '/' . trim($afterRoute, '/'); } } } } return false; }
public function actionIndex($id) { if (!($page = ContentPage::model()->findByPk($id))) { throw new CHttpException(404); } // No sidebar for 1st level pages without children if (Yii::app()->cms->currentAlias->isLeaf() && Yii::app()->cms->currentAlias->level == 2) { $this->layout = '//layouts/column1'; $this->rightColumnLayoutParent = '//layouts/column1'; } else { $this->layout = '//layouts/column2'; $this->rightColumnLayoutParent = '//layouts/column2'; } if (isset($this->module->layouts) && $page->layout != 'standard') { if ($page->layout == 'right_column_1') { $this->layout = '//layouts/rightColumn'; $this->rightColumnLayoutType = '//layouts/_rightColumnType1'; } elseif ($page->layout == 'right_column_2') { $this->layout = '//layouts/rightColumn'; $this->rightColumnLayoutType = '//layouts/_rightColumnType2'; } } $this->render('index', array('page' => $page)); }