[eluser]Ki[/eluser]
Modern sites rely on jQuery to make them snappy and cool, however it is resource intensive to include any and all possible jQuery plugins into all pages.
So lets say that on one page you need an image handling plugin, on another page a table plugin and on all pages another kind of plugin. And each one has their own config that is initialized on page load.
I may not have the best approach, but I load all my pages through a master view that loads header, footer and content. After the footer I load jQuery plugins dynamically. I have an array such as
array(
"controller1"=>array('module1', 'module2'),
"controller1"=>array('module1', 'module2')
)
in the footer, i check if controller matches a controller in array and that loads all js modules for that controller.
Anybody has a better way?