One of the core parts of creating Joomla! templates is using $this->countModules to show or hide code depending on if a module is in a particular position on the page. It is very powerful and it makes your templates very dynamic according to what is happening on the page. So what happens if you need to do this outside of the template index.php file? Save yourself a huge headache and use the following code in any file to check for a module position:
jimport( 'joomla.application.module.helper' ); if(count(JModuleHelper::getModules('left'))) { put your code here }
A very powerful addition to you Joomla! PHP library!
Thanks for given good information related to joomla.this function/condition is very useful to show or hide code.
Thanks for the joomla info!
thanks!, I had noticed this.
but I see that is not documented and is not practiced in the conventional templates.
Great tip. Can this be used in code.php that does not use ” defined( ‘_JEXEC’ ) or die( ‘Restricted access. Direct Access to this location is not allowed.’ );”
Amazing tip. did the job easy and fast.
thanks for your great tips….
Thank you very much