Add JavaScript or CSS in Block class

 To add JavaScript or CSS files to the head section of the resulting HTML page, you can add something like this to the _prepareLayout function of a Block class: $headBlock = $this->getLayout()->getBlock(‘head’); $headBlock->addJs(‘somefolder/ask-sheldon.js’); $headBlock->addCss(‘somefolder/ask-sheldon.css’); As you can see, we can use the layout model to get the head block an use its functions to add files. This […]

Get URL parameters

With the following function you can read out the parameters from the currently opened URL: function getUrlparam (param) { var search =; if(search.indexOf(‘&’) > -1) { var params = search.split(‘&’); for(var i = 0; i < params.length; i++) { var key_value = params[i].split(‘=’); if(key_value[0] == param) return key_value[1]; } } else { var params […]