[solved] [newbie] Breadcrumbs

Hi,

I can’t create the breadcrumb in one view, how I would! ;)

That’s what I’d like to have:

That’s the output:

And here is the view.php




<?php

$this->breadcrumbs=array(

    'Galleries'=>array('index'),

    $location.name=>array('location/view', 'id'=>$model->location_id),

    $model->title,

);


$this->menu=array(

    array('label'=>'List Gallery', 'url'=>array('index')),^M

    array('label'=>'Create Gallery', 'url'=>array('create')),^M

    array('label'=>'Update Gallery', 'url'=>array('update', 'id'=>$model->id)),^M

    array('label'=>'Delete Gallery', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),^M

    array('label'=>'Manage Gallery', 'url'=>array('admin')),^M

);^M

?>^M

^M

<h1><?php echo $model->title; ?></h1>^M

^M

<?php

/*

$this->widget('zii.widgets.CDetailView', array(^M

    'data'=>$model,^M

    'attributes'=>array(^M

        'location.name',

        'description',

        'date',

        'rating',

    ),^M

));

*/

?>

<div class="view">

    <h1><?php echo $model->title; ?></h1>

    <?php echo $location->name; ?><br />

    <?php echo $model->description; ?><br />

    <?php echo $model->date; ?>    <img src="images/rating_<?php echo $model->rating; ?>.png" /></div>

<?php foreach($model->pictures as $picture): ?><div class="thumbbox"><div class="thumbnail"><?php echo CHtml::link('<img src="gallery/'.$picture->gallery.'/th_'.$picture->picturenumber.'.jpg" alt="'.$picture- 

>picturenumber.'.jpg" />', array('pictures/view', 'id'=>$picture->id)); ?></div></div>

<?php endforeach; ?>



I’ve tried to assign the content from this to a variable like


$foo = $model->location.name;

in all possibilities ;)

But nothing works :(

I see the data from the table in <div class="view"> and CDetailView!

Neither $location.name nor $model->location.name are valid PHP variable names. How about $location->name?

That’s what I’ve tried too and the output was the following:


Home » Galleries »  » [gallery.name]

Then aparently $location doesn’t contain what you expect it to. It’s up to you to provide the correct data when calling render() in the controller. Maybe try a print_r($location)?

print_r(location) shows nothing.

But why I can see the data CDetailView?

Oh, didn’t notice the commented section. So i guess you want $model->location->name ?

Exactly what I want - works perfekt! THX