Yii Framework Forum: Is it possible to render a layout file independently? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Is it possible to render a layout file independently? Rate Topic: -----

#1 User is offline   SystemicPlural 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 129
  • Joined: 12-April 10

Posted 20 October 2010 - 07:22 AM

I need to render the standard /layout/column2.php file and return it as part of an ajax request. I don't want to render the whole page just to generate it. Is this possible? I can pass in the required data.
0

#2 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 20 October 2010 - 08:15 AM

You can create a widget with what you need of latout/column2, render the widget in layout/column2 and render in your controller where you have to render.

If you need only the operation menu, this is already a widget named CMenu, yu can simply render this widget.
0

#3 User is offline   SystemicPlural 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 129
  • Joined: 12-April 10

Posted 20 October 2010 - 11:34 AM

Thanks zaccaria. Exactly what I needed
0

#4 User is offline   SystemicPlural 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 129
  • Joined: 12-April 10

Posted 25 October 2010 - 05:40 AM

I'm having trouble getting the title of the sidebar to render.

my code:

$this->beginClip('widget');
$menu_widget = $this->widget('zii.widgets.CPortlet', array(
	'title'=>'Operations',
));
$menu_widget->widget('zii.widgets.CMenu', array(
	'items'=>$this->menu,
	'htmlOptions'=>array('class'=>'operations'),
));
$this->endClip();
$sidebar = $this->clips['widget'];


$sidebar now contains the menu, except for the title (and its css). How to I get the clip to render the title as well.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users