Keyword

Hide module on item page

  • Alexander van Aken
  • Alexander van Aken's Avatar Topic Author
  • Offline
  • New Member
More
8 years 2 months ago #156077 by Alexander van Aken
Hide module on item page was created by Alexander van Aken
HI. I have a menu called BLOG linked to a category called BLOG. On only that BLOG menu page, I allowed several 3rd party modules to show up. Normally they only show up on those pages. But it seems, because items do not have their own menu item, this doesn't work. What do I need to do. I found a post where I need to insert add the following on top of my template index.php Or in the k2 item.php file of the template override?

<?php $view = $_REQUEST; ?>
<?php $option = $_REQUEST; ?>

Then find my module and add the option and view

<?php if ($this->countModules( 'your_mod_position' ) && $option=='com_k2' && $view=='itemlist') : ?>
<jdoc:include type="modules" name="your_mod_position" />
<?php endif; ?>

Since I'm not much of a programmer, but probably can handle it, I wanted to ask here first if this is the way to go still since this post is pretty old. stackoverflow.com/questions/12660182/show-a-module-on-k2-category-page-but-not-in-item-page

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

  • Alexander van Aken
  • Alexander van Aken's Avatar Topic Author
  • Offline
  • New Member
More
8 years 2 months ago #156078 by Alexander van Aken
Replied by Alexander van Aken on topic Hide module on item page
What I do not get is this:
<?php if ($this->countModules( 'your_mod_position' ) && $option=='com_k2' && $view=='itemlist') : ?>
<jdoc:include type="modules" name="your_mod_position" />
<?php endif; ?>

Where that jdoc is included.... I'm working with T3 UBER. They do not use those in the template on the regular way I guess. I'm probably missing something.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 2 months ago - 8 years 2 months ago #156084 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hide module on item page
Generally speaking this is the code you should use as a starting point.
Do not forget to change the module's position.

As for where you need to this code, this is a template specific question which you have to address to the template's developer. T3 uses multiple blocks for building the template, instead of a single.php file.
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');

<?php if(!($option=='com_k2' && $view=='item')) : // if it is not an item proceed ?>
 <?php if($this->countModules('YOUR_MODULE_POSITION')) : ?>
     <div class="position-2">
           <jdoc:include type="modules" name="YOUR_MODULE_POSITION" style="inherited" />
     </div>
<?php endif; ?>
<?php endif; ?>

Alternatively you can use an extension like Module's anywhere.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 8 years 2 months ago by Krikor Boghossian.

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


Powered by Kunena Forum