In joomla one of the best extension is template, in template we can add number of position based on our site requirements. Here i am going to explain how we add/remove positions dynamically based on content. if you need to display the position only in that position module have content. Here is the easy way to do it
$doc =& JFactory::getDocument();
$buffer=$doc->getBuffer( 'modules', 'right', array());
if (!empty($buffer)) {
<jdoc:include type="modules" name="right" />
}
if the right position modules content not empty mean right position will load in your template similar to other postion.
$doc =& JFactory::getDocument();
$buffer=$doc->getBuffer( 'modules', 'positionname', array());
if (!empty($buffer)) {
<jdoc:include type="modules" name="positionname" />
}
based on the above code you can easily enable or disable the position dynamically in joomla template.
(ex)
$doc =& JFactory::getDocument();
$buffer=$doc->getBuffer( 'modules', 'right', array());
if (!empty($buffer)) {
<jdoc:include type="modules" name="right" />
}
if the right position modules content not empty mean right position will load in your template similar to other postion.
No comments:
Post a Comment