[SOLVED] Yii 1.0.x to Yii 1.1.x Normal tables to Cgridview

Hi Eveyone,

Hope everyone is doing fine.

I needed your assistance as i cannot figure this out. I have been developing an app using Yii for almost 2 years now. Our team started with Yii 1.0.x version and now we are currently working with Yii 1.1.x. There were few place e.g. html tables which we did not update to cgridview and we do not need them to be cgridview.

But i need to use the same css which is used in the default cgridview for those tables

I dont want to make a copy of styles.css from zii folder and then use it cause if there is an update to Yii i will need to keep merging the changes.

Can you guys and gals help me get a better solution? Like if i can get the css file from the assets directly or something like that.

Thanks and Regards,

Wenceslaus Dsilva

bump

bump

When a "zii" widget runs it publishes the zii.widgets.assets folder (this may not be true for the JUI widgets in zii). So, if you need the path for the zii widget assets, in this case the css for CGridView, you can simply use the following code:




Yii::app()->clientScript->registerCssFile(

    Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets')).

    '/gridview/styles.css');



Here, we first get the real path of the assets using:


Yii::getPathOfAlias('zii.widgets.assets')

This path is then published (if the folder already exists, it will not be copied again as force copy is false by default)


Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets'))

publish returns to us the path which is used to register the css file

Thank you for your reply. Making this post as solved