Cbreadcrumbs not displaying properly

Hi All,

I am having problems printing passing data to $this->breadcrumbs. It’s passed in a correct format, but prints the raw text instead of converting it to the proper format. For example:

As a baseline, this code properly displays a breadcrumb like: Home > Food and Food is linked to site/strat.


$this->breadcrumbs=array('Food'=>array('site/strat','link'=>1));

I derive the string above in my code and build a string called $cat_path. When I try to pass the content of the string like below


$this->breadcrumbs = array($cat_path);

the following displays:

Home » ‘Food’=>array(‘site/strat’,‘link’=>1) where as it should display Home > Food and food should be linked according to the array.

The string contains the following:


'Food'=>array('site/strat','link'=>1)

and a var_dump of $this->breadcrumbs looks like:


array (size=1)

  0 => string ''Food'=>array('site/strat','link'=>1)' (length=37)

whereas I think it should look like:


array (size=1)

  'Food' => 

    array (size=2)

      0 => string 'site/strat' (length=10)

      'link' => int 1

Any help would be appreciated.

Thanks,

Remo

It should just be




$cat_path = array('Food'=>array('site/strat','link'=>1));

$this->breadcrumbs = $cat_path;



I think.

Thanks for your reply. That worked to a certain extent. The problem I’m having is building the string, storing it in a database and then using it in breadcrumbs. You’re tip helped, but I think I have some more logic to think through on my end.

Thanks,

Remo

You could store that array in your db with php’s serialize function, and restore it with unserialize