Yii Framework Forum: Change Widget CSS - Yii Framework Forum

Jump to content

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

Change Widget CSS I want to know how to.. Rate Topic: -----

#1 User is offline   zyphers 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 04-March 10

Posted 19 April 2010 - 05:16 AM

I call widget in view page like this.

$this->widget('MyCustomWidget');


And it gives HTML rendered like this.

<div id="yw2" class="portlet">
<div class="portlet-content">
...what my custom widget does...
</div>
</div>


Those two DIVs are generated by widget function.
The problem are the already defined CSS classes.
I want to modify these classes specific by each widget.

Do anyone have suggestions how to do this?

Thanks in advance.
0

#2 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 19 April 2010 - 05:34 AM

Check out the http://www.yiiframew...oc/api/CPortlet

You have:

contentCssClass http://www.yiiframew...CssClass-detail

decorationCssClass http://www.yiiframew...CssClass-detail

titleCssClass http://www.yiiframew...CssClass-detail

You will need to do:

$this->widget('MyCustomWidget', array('titleCssClass'=>'my-custom-class'));


Same for the other properties.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
0

#3 User is offline   zyphers 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 04-March 10

Posted 19 April 2010 - 10:10 PM

Great! Thanks.
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