rendering methods in Yii

Hi friends,

Do we have any other methods like "render" and "render-partial"

If there are any,please mention them and try to explain there functionality.

Hello ,

Instead of posting here you have to search on net.

Yii has rich documentation that explain each and everything , so first try to read that.

this will help you ,

Thanks a lot my dear

You can always create your own ‘render’ method on a per controller basis or the controller component in the components directory.

Here’s an example this is a custom render method.

        public function render($view,$data=null,$col1data=null,$col1view=null,$return=false)







                    } else {



                            $col1 = $col1data;



                        $col1 = null;








				return $output;


				echo $output;



This is how I am using it.


Notice that I am sending values to render two views. The first values are being rendered using a view that Is absolutely defined (does not matter which controller). So the first view is ‘content’ the second view renders different values, the second view is in my controller specific ‘views’ directory.

The end result is that the layout file now has two values that it can echo on the final output. First variable is $content, like we always have the second value is $col1.

So now in the layout file ‘column2.php’

<?php $this->beginContent('//layouts/main'); ?>

<div class="container">

	<div class="span-16"><!-- sidebar -->

        <div id="content">

<?php echo $content; ?>



	<div class="span-8 last"><!-- content -->

		<div id="right-column">

<?php echo $col1; ?>




<?php $this->endContent(); ?>

Left column and right column can have discreet data and the controller passes this info along.

I am thinking that I can create a better render method by supplying an array of arrays. But I haven’t got there yet :)