1

I am programming a component with two views, let's say:

View1: Category

View2: Article

In the menu manager I set the category as the entry point to my component.

The template has a sidebar next to the content where I display some modules. For the category view, that is fine; i want to see the modules in the sidebar, however in the article view, I would like to disable the sidebar completely, as this view needs more space.

Since the article view does not have a menu item, I cannot simply deactiviate the modules in the menu manager, am I right?

So, what my suggested way would be to somehow deactivate teh render-position functions from my component (or empty the module-list of a certain position??)

Any help is greatly appreciated :-)

Yosh

1 Answer 1

0

Modify your main template file (/templates/YOURTEMPLATE/index.php) and use something like this to disable sidebar:

$input = JFactory::getApplication()->input;
$component = $input->get('option');
$view = $input->get('view');

$disable_sidebar = ($component==='com_mycomponent' AND $view==='mycomponentarticleview');

Use $disable_sidebar in your template HTML to decide if sidebar should be visible.

2
  • Thanks. This is the way I am doing it right now. Since I want to rlease the component sooner or later, I was hoping there would be a solution to do in a component.
    – Yosha
    Jul 18, 2015 at 10:42
  • No. Component has its own output. You can do something like this only in template. You can always try to create plugin for that but that is bad idea. You should never interfere in template layout with your component. That makes it less flexible and may annoy many developers that can be your potential clients. In short: It is bad of business. Jul 18, 2015 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.