Element as view

I would like apologize for my mistakes, which are the result of my poor knowlege of English

How can I do, to I could in my view of controller, render some element, which is a view.

example: I have group controller and group/index.php view, I have too group/info.php view. In info.php I have only information about group (about 5 lines code). Also I have group/name.php view. In name.php and index.php I want to display info.php, but I need in each view set different values, to info.php.

How I can do it?

I hope, that you understand me.

Welcome to the forum.

If I understand your problem correctly you can use a partial view for displaying info about a group.

In index.php/name.php, create an array containing the info (e.g. $groupInfo).

Then call renderPartial

<?php echo $this->renderPartial('info', array('array name in subview'=>$groupInfo)); ?>

If you tried out Gii and generated crud code for some model, you’ll find this kind of view relationship between create.php/update.php and the subview _form.php (located in the protected/views/yourcontroller subdirectory).


I’m dumb!

You gave me correctly solution! That’s it!

Thanks You.

ps. pity that, I can’t still put emoticons