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\'))
$this->getLayout()->getBlock('head')->addJs('path');
Its the right code, search if your path is right.