I need to create a block programatically (for various reasons):
$myblock = Mage::app()->getLayout()->createBlock('namespace_module/path', 'my_block', $params);
This works fine, but the controller action is skipped over when doing this. I mean, it is, right? Therefore, my XML layout file is ignored, which contains:
<layout> ... <reference name="head"> <action method="addJs"> <script>namespace_module/script.min.js</script> </action> </reference> ... </layout>
I have tried adding the JS file programmatically as follows, but I get nothing at all:
I will also need to reference the CSS file. It's late, so this could be a stupid error. Any guidance/advice welcome. Thank you.