30ml Posted November 8, 2011 Share Posted November 8, 2011 hello guy, I am stop on one point. Here, I have a module and I want to show on only home page. How do I configure. Your help will be highly appriciate. 1 Link to comment Share on other sites More sharing options...
marty69 Posted November 8, 2011 Share Posted November 8, 2011 hi, check the module transplant function in back-office. when you transplant a module or edit/create a module position you can fill in the field "exceptions". Fill in this field with pages (comma separated) you don't want the module to appear : index.php (home page) order.php (order page) category.php (product list pages) product.php (product page) ... and so on 2 Link to comment Share on other sites More sharing options...
30ml Posted November 22, 2011 Author Share Posted November 22, 2011 Is there any way that if I can specify to show on only in home . Ex only home. Rather than mentioning for several page for exception. Making exception would be the current medecine but if i add next page then I have to add that page in exception and I do not know how many page I need to put on exception. Do any body know ? Link to comment Share on other sites More sharing options...
Carolina Custom Designs Posted November 22, 2011 Share Posted November 22, 2011 Yes you can. In your module tpl just add the following to the top {if $page_name == index} then at the very bottom of your module add {/if} That should work. Hope that helps! Marty Shue 6 Link to comment Share on other sites More sharing options...
s33m0n Posted April 22, 2012 Share Posted April 22, 2012 you are the men, men!! thanks, works great Link to comment Share on other sites More sharing options...
jhnstcks Posted April 22, 2012 Share Posted April 22, 2012 Yes you can. In your module tpl just add the following to the top {if $page_name == index} then at the very bottom of your module add {/if} That should work. Hope that helps! Marty Shue The problem with this method, as has just been pointed out to me, i that the module code is still run will always be run even if the output is not displayed, which can rise to performance issues. The module will also insert any javascript and/or css it needs making it even worse! 1 Link to comment Share on other sites More sharing options...
creacom Posted March 19, 2013 Share Posted March 19, 2013 (edited) The module will also insert any javascript and/or css it needs making it even worse! I agree, i have the same issue. But can you tell how to workaround ? It seems that setting the css and/or js inline with the template content isn't a right way And setting all pages but one as exception in the module managemenent isn't either. So, isn't there a way to do it in the module code ? ... public function hookHeader($params) { //only on specific page, like home or other ? Tools::addJS(_MODULE_DIR_.'myspecific.js', 'all'); } Edited March 19, 2013 by creacom (see edit history) Link to comment Share on other sites More sharing options...
haunter Posted April 13, 2023 Share Posted April 13, 2023 For those looking for it in v1.7: $page.page_name Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now