Question

I would like to use breadcrumb with variable.

I first look for the category (passed when the view is called)

$label = Category::model()->findByPk($category_id);  // I get the category record for a given category_id  (in this case, movies)

then I display the breadcrumbs with the following code

$this->breadcrumbs=array(
    $label->name => array('index','category_id='.$label->id),
    'Create',
);

as a display point of view it is correct, it displays

 Home » Movies » Create

but when I click on Movies the url is

localhost/post/index.php/index?0=category_id=1

instead of

localhost/post/index.php/index?category_id=1

where does the 0= comes from ?

thank you for your help

Was it helpful?

Solution

Try this

$label->name => array('index','category_id'=>$label->id),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top