Module Assignment

  • Posts: 28
  • Thank you received: 0
13 years 3 months ago #22643

I have a custom HTML module which is displayed on all pages, but i want to hide it on Product Page. Is this possible, or is there another way to do that.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 3 months ago #22661

There are two solutions:
1. You set your module to a position of your template where it is alone. In the index.php of your template, you add some code around the position loading code to display or not the position based on whether it's the product page or not, like that:

if(JRequest::getVar('ctrl')=='product'&&JRequest::getVar('task')=='show'){
// display position modules code
}

2. You add the same PHP code around the code of your module's php file.

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 0
13 years 3 months ago #22726

I am having trouble to get this to work. Here is code from index.php. Am i doing something wrong?

<div id="fles">
if(JRequest::getVar('ctrl')=='product'&&JRequest::getVar('task')=='show'){
<jdoc:include type="modules" name="fles" style="xhtml" />
}
</div>

masina-shop.co.rs/index.php/odeca/product/show/231-beer-exit

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 3 months ago #22727

You need to add PHP tags around the php code. It should be like that:

<div id="fles">
<?php if(JRequest::getVar('ctrl')=='product'&&JRequest::getVar('task')=='show'){ ?>
<jdoc:include type="modules" name="fles" style="xhtml" />
<?php } ?>
</div>

Please Log in or Create an account to join the conversation.

  • Posts: 28
  • Thank you received: 0
13 years 3 months ago #22731

Now it's working but it is opposite to what i want. Maybe i wasn't clear on first post. Now module is showing only on product page, but i want to show it everywhere except on product page.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
13 years 3 months ago #22735

Then you need to do the opposite:

<div id="fles">
<?php if(!(JRequest::getVar('ctrl')=='product'&&JRequest::getVar('task')=='show')){ ?>
<jdoc:include type="modules" name="fles" style="xhtml" />
<?php } ?>
</div>

Please Log in or Create an account to join the conversation.

Time to create page: 0.042 seconds
Powered by Kunena Forum