I need to add a JS file conditionally and programmatically inside a block file. I tried with these codes:
if (Mage::getStoreConfig(\'mymodule/settings/enable\'))
I know this was asked a long time ago, but in case somebody is looking for this, I would suggest to use this in your local.xml:
Of course this is for JS files located in /js/ folder. Use the appropriate method if you want to add skin_js or skin_css.
PS. Tested on CE 1.9