I’m working on a project that extensively uses SIFR for making fonts look cool. However, there are some pages in Magento that we do not wont to load the SIFR’s javascript files. How do we selectively load JavaScript in Magento on some pages?
By using $this->getRequest()->getControllerName() on any of your files in template folder you would get the name of the current controller. If you are on let’s say http://somesite.domain/shop/index.php/checkout/onepage/ page, your controller name is onepage. By using the above mentioned code your result would be string “onepage“. So all you need to do is to write a simple IF statement like
<?php if($this->getRequest()->getControllerName() !== ‘onepage’) { ?>
<!– PUT SOME JS LOADING HTML HERE –>
<?php } ?>
This seems like a perfect solution for some minor stuff. Hope you find some use for it.