0

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?

1

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.