Created
April 4, 2014 08:07
-
-
Save Maxcorp/9970196 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function actionSection($section) | |
{ | |
$model = Section::model()->findByAttributes(array('vis'=>'1'), | |
"url_alias=:section", | |
array(":section"=>$section)); | |
if(!$model || $model->pid){ | |
throw new CHttpException(404); | |
} | |
Controller::$current_section = $model->id; | |
if($model->img) { | |
Controller::$section_img = $model->img; | |
} | |
//Установка meta-данных | |
$this->setMeta($model->meta_title, $model->meta_keywords, $model->meta_description, $model->name); | |
$model = Gallery::insertGalleries($model); | |
$this->breadcrumbs = array('homeLink'=>CHtml::link('Главная','/'), | |
'separator'=>' <span>•</span> ', | |
'links'=>array($model->name), | |
'htmlOptions' => array('class' => 'b-breadcrumbs')); | |
$this->render('section', array('model'=>$model)); | |
} | |
/* | |
* Разделы 2-го уровня | |
*/ | |
public function actionSubsection($section, $subsection) | |
{ | |
$model = Section::model()->findByAttributes(array('vis'=>'1'), | |
"url_alias=:subsection", | |
array(":subsection"=>$subsection)); | |
if(empty($model) || empty($model->_parent) || ($section != $model->_parent->url_alias)) { | |
throw new CHttpException(404); | |
} | |
Controller::$current_section = $model->id; | |
//Установка meta-данных | |
$this->setMeta($model->meta_title, $model->meta_keywords, $model->meta_description, $model->name); | |
$model = Gallery::insertGalleries($model); | |
$this->breadcrumbs = array('homeLink'=>CHtml::link('Главная','/'), | |
'separator'=>' <span>•</span> ', | |
'links'=>array($model->_parent->name=>array("/{$model->_parent->url_alias}/"), | |
$model->name), | |
'htmlOptions' => array('class' => 'b-breadcrumbs')); | |
$this->render('section', array('model'=>$model)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment