Is there a way to dynamically declare which javascript files to include in the <head> section of the layout file?
I have a login.js that contains form validation and login specific javascript that i want to place in the <head> section of the layout but I don’t want it to be included on every page.
I know I can just write a bunch of if…else in the layout file to check for the view file and include the needed files but this is so nasty and will become unmaintainable very quickly. The ideal scenario would be for each view file to control which js files to include.
Any other idea? If only Yii layout supports multiple content sections.