Example #1
0
 public static function getChilds($id)
 {
     $data = array();
     foreach (Category::model()->findAll('parent_id = ' . $id) as $model) {
         $row['text'] = CHtml::link($model->title, array('category/view', 'id' => $model->category_id));
         $row['children'] = Category::getChilds($model->category_id);
         $data[] = $row;
     }
     return $data;
 }
Example #2
0
<?php

$this->Widget('CTreeView', array('data' => Category::getChilds(0), 'animated' => 'slow', 'collapsed' => 'true', 'persist' => 'cookie'));
Example #3
0
}
?>
    </td>

    <td align="center">
        <?php 
if (isset($data->child)) {
    ?>
            <span class="parent">
                <span  title="
                    <h2 class='t-chead'><?php 
    echo Yii::t('' . Yii::app()->request->cookies['language']->value . '', 'Subcategories');
    ?>
</h2>
                    <?php 
    foreach (Category::getChilds($data->child->id) as $item) {
        ?>
                        <div class='t-subcat'>
                            <?php 
        echo $item->name;
        ?>
                            <span class='t-cnum'>#<?php 
        echo $item->position;
        ?>
</span>
                            <div class='clear'></div>
                        </div>
                    <?php 
    }
    ?>
                "><?php