Loading JavaScript in Magento Selected Pages
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’) { ?> // your javascript statements goes here <?php } ?>
I hope you guys find this one helpful.
2 Comments
SEO India on July 13th, 2010
220Thanks for your nice posting keep it up, I am always looking for such types of enormous information’s.

Welcome to my blog site. My name is Anunay Dahal. I'm currently working
louboutin shoes on May 15th, 2010
209coooooooool post,thank you for sharing