Xpert Access

Hide position in Joomla template

In some cases, where a side bar is present in your Joomal Template it can be obstrcutive as some flash games need to have a wide space. Unfortunately, there is no way for a Joomla component to influence the behaviour of modules in the layout. (And I tried diferent ways, including a system plugin). However, with a little bit of template hacking this can be achieved easily.

Basically, we do not want the module position (let's call it sidebar-a) to appear, when the component yoflash is called and when the view game is called. The biggest hurdle here is to find the right line, where to insert the code. This is different from template to template and can be quite a long search for Template Frameworks (like Gantry, T3 etc).

Here is the basic example for the protostar template:

In the protostar template, two changes are required to show the component in full width. They are both located in the file /templates/protostar/index.php

At around line 63 find:

else
{
    $span = "span12";
}

Directly behind that (on the next line) add:

if($option=="com_yoflash" && $view=="game") {
    $span = "span12";
}

OK, we are now saying, that the component shall be displayed in full width, but the left and right modules (position-7 and position-8) are still displayed. Go to line 159 and find:

<?php if ($this->countModules('position-8')) : ?>

replace the line with:

<?php if ($this->countModules('position-8') && ($view!="game") ) : ?>

We need to do the same for position 7 which is located in line 176:

<?php if ($this->countModules('position-7')) : ?>

replace with:

<?php if ($this->countModules('position-7') && ($view!="game") ) : ?>

And that's it for the protostar template.

 

An example for the T3 framework:

The same concept as for the protostar template is used for the T3 template. First, we need to tell tehframework to use full width. In my case, I found the file /templates/your-t3-template/tpls/blocks/mainbody.php

In there at around line 53 (this will be different depending on your actual template), I found something like:

  } else {
    $layout = 'no_sidebar';
  }
Directly under it, I added:

  $jinput=JFactory::getApplication()->input;
  if( ($jinput->get("option",NULL,"STRING")=="com_yoflash") && ($jinput->get("view",NULL,"STRING")=="game")) {
      $layout = 'no_sidebar';
  }
basically saying, that when the component is yoflash and teh view is game, I want the component to show without sidebars.

In my template, there are two sidebars, sidebar1a dn sidebar2. Locate the

<?php if ($this->countModules($sidebar1)) :

statement. In my template it is around line 72, and replace it with:

 <?php if ($this->countModules($sidebar1) && $jinput->get("view",NULL,"STRING")!="game") :

I did the same for sidebar two, to be foudn at around line 82. And we are done.

 

I will try to add more template specific examples later on, but please do not ask questions about this in the forum. As this is not directly related to yoflash but to templates, you have to ask in a different forum for help.