Display Name Instead Id In View

Happy Day… to All

I was Very new to Yii framework, I just started to learn and it was very interesting, and with reference of Agile book I have started a sample project, I don’t know how to display names instead of title_id can change in manage page but not in view page ., Please any one help me.

For the past one week i was trying to solve this…

But nothing works…Plz any one help me to solve this…

Hey, Look for a file called update.php, in your view files,and change the line

<h1>Update <?php echo $model->id; ?></h1>


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

Let us know if this is what you were looking for.

No friend i insert my screen shot here see that i want to change the id to name…

What you mean by manage?

Where you want to display name instead of id?

Thanks for your reply Aneesh… i explain in my screen shot

Its the view page for an entry in that model. Not sure what you mean by manage page? Is it admin page?


Post the code

see here…

in your view change id to title… i.e. $model->title like someone said above. or the content and /or title in your database is saved as 2 and that’s not the id.

Thank you friends i cleared out …

in my model page i had added

    public function showParent(&#036;id)


       &#036;parent_title = self::model()-&gt;findByPk(&#036;id);  

       return &#036;parent_title['title'];


and my view file…

    &#036;this-&gt;widget('zii.widgets.CDetailView', array(