Skip to main content

Module Assignment

More
15 years 1 month ago #22643 by bora983
Module Assignment was created by bora983
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.

More
15 years 1 month ago #22661 by nicolas
Replied by nicolas on topic Re: Module Assignment
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.

More
15 years 1 month ago #22726 by bora983
Replied by bora983 on topic Re: Module Assignment
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.

More
15 years 1 month ago #22727 by nicolas
Replied by nicolas on topic Re: Module Assignment
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.

More
15 years 1 month ago #22731 by bora983
Replied by bora983 on topic Re: Module Assignment
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.

More
15 years 1 month ago #22735 by nicolas
Replied by nicolas on topic Re: Module Assignment
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.182 seconds
Powered by Kunena Forum