function action_index() { $page = new ContentPage(); $page->setTitle('My Application'); $page->setText('Introducing one more application at the top Phoebius Framework'); return $this->view('content', array('page' => $page)); }
public function index($alias) { $lang = Session::get('lang'); $content = ContentPage::where('published', '=', 1)->where('language', '=', $lang)->get(); $pages = ContentPage::where('alias', '=', $alias)->get(); if (count($pages) == 0) { return Response::view('errors.missing', array(), 404); } return View::make('public.contentpage.index')->withPages($pages)->withContent($content); }
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)); }
public function setContentPage(ContentPage $contentPage) { $this->contentPage = $contentPage; $this->set_field(self::CONTENT_PAGE, $contentPage->getID()); }
public function deleteContentPage($id) { $content_page = ContentPage::where('id', '=', $id); $content_page->delete(); return Redirect::to('/admin/contentpage')->withErrors(['msg' => ['Страница удалена!']]); }