Answer the question
In order to leave comments, you need to log in
How to create a separate layout for secondary pages in Joomla 3?
The task is to create a separate layout for displaying content. The idea is that the main page does not have a sidebar, but the secondary ones should have one.
For example, I want the layout on the main page to be like this:
<div class="header">
HEADER
</div>
<div class="row">
<div class="col-md-12">
CONTENT
</div>
</div>
<div class="header">
HEADER
</div>
<div class="row">
<div class="col-md-3">
SIDEBAR
</div>
<div class="col-md-9">
CONTENT
</div>
</div>
Answer the question
In order to leave comments, you need to log in
In general, I found the answer for myself: if it is necessary to separate the layout of the main page (for example, the main page we have is a long landing page, and the secondary ones come with a sidebar), then you need to write a small php-construct in the index.php file located at the root of the folder template to define the main page.
<?php $myVar = $_SERVER['REQUEST_URI'];
if ($myVar == '/' or $myVar=='/index.php') {?>
<div>Its mainpage</div>
<?php } else {?>
<div>its secondpage</div>
<?php } ?>
What is wrong with the usual output of modules?
just then you choose that everywhere except the main one and that's it
<?php
if ($this->countModules('position-1')) : ?>
<jdoc:include type="modules" name="position-1" style="none" />
<?php endif; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question