Search code examples
yiiyii1.xyii-booster

get Published assets url from out side the extension yii1


I am making a plugin File Manager for redactorJs to be used in Yii1 Framework and i have some custom view files and a controller that are used inside the plugin, inside those view files i have to reference some js and css files from that plugin directory.

For RedActor i am using YiiBooster extension. I have placed my plugin inside the extensions/booster/assets/redator/plugins/my_plugin, now when yii initializes booster it publishes all assets to the web assets directory means to the assets folder inside my project root, i need to get that path that it creates with the random directory name, can any one guide me how can i get that. i tried using

Yii:import('application.extensions.booster.components.Booster');

and then trying to access Booster::_assetsUrl but it says

Fatal error: Undefined class constant '_assetsUrl'


Solution

  • I needed to use the

    Yii::app()->booster->getAssetsUrl()
    

    to get the published assets path for the YiiBooster Extension.