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?
Asked
Active
Viewed 486 times
0
-
1http://stackoverflow.com/questions/8933024/yii-external-js-files-inlclude-registerscriptfile-and-publish – Telvin Nguyen Oct 27 '13 at 11:22
1 Answers
1
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

Community
- 1
- 1

Developerium
- 7,155
- 5
- 36
- 56