Reputation: 10061
I am working with an application using Yii. I need to add a JavaScript file for a specific controller and action. What is not necessary to load or add will go in another controller and action. How can I do this?
Upvotes: 0
Views: 523
Reputation: 7265
Put your javascript in a layout or theme and add if you're in right controller.
You can find out your controller name like: Getting Current Controller ID in Yii
and register your javascript if you're in this controller, like @Telvin Nguyen said: Yii - External JS files Inlclude , registerScriptFile and publish
Upvotes: 1