O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
While using a theme we can quickly change the outlook of views, we can use skins to<br />
systematically customize the outlook of the widgets used in the views.<br />
A skin is an array of name-value pairs that can be used to initialize the properties of a<br />
widget. A skin belongs to a widget class, and a widget class can have multiple skins<br />
identified by their names. For example, we can have a skin for the CLinkPager widget and<br />
the skin is named as classic.<br />
In order to use the skin feature, we first need to modify the application configuration by<br />
configuring the CWidgetFactory::enableSkin property to be true for the widgetFactory<br />
application component:<br />
return array(<br />
'components'=>array(<br />
'widgetFactory'=>array(<br />
'enableSkin'=>true,<br />
),<br />
),<br />
);<br />
Please note that in versions prior to <strong>1.1</strong>.3, you need to use the following configuration to<br />
enable widget skinning:<br />
return array(<br />
'components'=>array(<br />
'widgetFactory'=>array(<br />
'class'=>'CWidgetFactory',<br />
),<br />
),<br />
);<br />
We then create the needed skins. Skins belonging to the same widget class are stored in a<br />
single PHP script file whose name is the widget class name. All these skin files are stored<br />
under protected/views/skins, by default. If you want to change this to be a different<br />
directory, you may configure the skinPath property of the widgetFactory component. As an<br />
example, we may create under protected/views/skins a file namedCLinkPager.php whose<br />
content is as follows,