Difference between revisions of "Multiple layouts with one template"

From Joomla! Documentation

(New page: I found that it was a bit of a pain to code and keep track of multiple templates so ive been searching for a way to do this in Joomla 1.5. I stumbled upon this solution thru a few differen...)
 
(No difference)

Latest revision as of 06:38, 2 August 2008

I found that it was a bit of a pain to code and keep track of multiple templates so ive been searching for a way to do this in Joomla 1.5. I stumbled upon this solution thru a few different threads.

Basically I'm testing for the existence of say Fireboard and delivering a unique layout for that & testing for MyBlog then delivering a different layout for MyBlog and if none of these exist then just churn out the standard content block.

You should be able to swap these values out for any component.

<?php if (JRequest::getVar('option') == 'com_fireboard' ) {?> <!--code to detect Fireboard is loaded-->

  <div class="MainCol">
    <jdoc:include type="component" />
  </div>
  <div class="RightCol">
    <jdoc:include type="modules" name="RightCol" style="none" />
  </div>

<?php  }  elseif  (JRequest::getVar('option') == 'com_myblog') {?> <!--code to detect Blog is loaded-->

  <div class="LeftCol">
     <jdoc:include type="modules" name="LeftCol" style="none" />
  </div>
  <div class="MainCol">
     <jdoc:include type="component" />
  </div>
               
<?php  }  else {?>

   <jdoc:include type="component" />
          
<?php   } ?>