<ul class="header-menu-primary__dropdownmenu__container"> <li class="dropdownmenu__item"> <ul class="dropdownmenu__item__list"> <?php $data_cat = new Category(); $list = $data_cat->findAll(); $i = 1; foreach ($list as $k => $v) { //if($i%8==0) { // echo '</ul></li>'; // echo ' <li class="dropdownmenu__item"> // <ul class="dropdownmenu__item__list">'; //} echo '<li class="dropdownmenu__item__list__item"><h3 class="dropdownmenu__item__list__item__title">' . $v->name . '</h3></li>'; $model = new Occupation(); $list1 = $model->localized('ru')->findAll('cat_id=:cid', array(':cid' => $v->id)); $i = 1; foreach ($list1 as $k1 => $v1) { //echo '<li class="dropdownmenu__item__list__item"><a href="" class="dropdownmenu__item__list__item__link">Воздушные акробаты<span class="dropdown__link__col"> (25)</span></a></li>'; if ($v1->alias != '') { $alias = $v1->alias; } else { $alias = Settings::toLatin($v1->name); Occupation::model()->updateByPk($v1->id, array('alias' => $alias)); } if (Yii::app()->getRequest()->getParam('id') == $v1->id && Yii::app()->controller->id == 'cat') { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link dropdownmenu__item__list__item__link--current">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; } else { echo '<li class="dropdownmenu__item__list__item"><a href="' . $this->createUrl('/cat/view', array('alias' => $alias)) . '" class="dropdownmenu__item__list__item__link">' . $v1->name . '<span class="dropdown__link__col"> (' . Occupation::CalcUsers($v1->id) . ')</span></a></li>'; } //$i++;