E
E
EVOSandru62015-01-28 09:05:07
Yii
EVOSandru6, 2015-01-28 09:05:07

How to make breadcrumbs as links in Yii using NestedSet?

Good afternoon,
I made such a function in the model:

static function getBreadcrumbs($id){
        $root = Product::model()->findByPk($id);
        $ancestors = $root->ancestors()->findAll();
        $arr = array();
        $arr[] = "Главная";
        foreach($ancestors as $one){
            $item = CHtml::link($one->getName(), array('product/item/id/'.$id));
            $arr[] = $item;
        }
        return $arr;
}

In the controller I call and send to the view:
$breadcrumbs=$model->getBreadcrumbs((int)$_GET['id'])

In the form I write:
$this->breadcrumbs = $breadcrumbs;
And I get the following line:
Home » Visas » Exit visas (countries)
I.e. links not as links but as htmlspesialChars . How to properly make NestedSet crumbs as links to nodes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2015-02-08
@webinar

And what does NestedSet have to do with it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question