Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
step 17 - conditional load page layout
Browse files Browse the repository at this point in the history
  • Loading branch information
hans2103 committed Jan 30, 2015
1 parent c58e6b1 commit b8403dc
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 14 deletions.
11 changes: 10 additions & 1 deletion helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
// Check upon the current page layout
$pagelayout = $this->params->get('pagelayout', '1column');

// Determine whether to show sidebar-A (@todo: Jisse, clean up this mess)
$SidebarA = false;
$SidebarB = false;

Expand Down Expand Up @@ -89,3 +88,13 @@
{
$pagelayout = '3column';
}

if($helper->isHome())
{
$pagelayout = 'homepage';
}





49 changes: 36 additions & 13 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,42 @@
</header>

<main>
<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-push-4 col-md-9 col-md-push-3">
<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<div class="col-sm-4 col-sm-pull-8 col-md-3 col-md-pull-9">
<jdoc:include type="modules" name="sidebar-a" style="none" />
</div>
</div>
</div>
<?php if ($this->countModules('content-top')): ?>
<aside>
<jdoc:include type="modules" name="content-top" style="no" />
</aside>
<?php endif; ?>

<?php
switch($pagelayout)
{
case 'homepage':
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/homepage.php';
break;

case '1column':
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/1column.php';
break;

case '2column-left':
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/2column-left.php';
break;

case '2column-right':
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/2column-right.php';
break;

case '3column':
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/3column.php';
break;

default:
include_once JPATH_THEMES.'/'.$this->template.'/pagelayout/1column.php';
}
?>
<?php if ($this->countModules('content-bottom')): ?>
<jdoc:include type="modules" name="content-bottom" style="no" />
<?php endif; ?>
</main>

<footer>
Expand Down
8 changes: 8 additions & 0 deletions pagelayout/1column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
defined('_JEXEC') or die;
?>

<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
17 changes: 17 additions & 0 deletions pagelayout/2column-left.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
defined('_JEXEC') or die;
?>

<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-push-4 col-md-9 col-md-push-3">
<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<div class="col-sm-4 col-sm-pull-8 col-md-3 col-md-pull-9">
<jdoc:include type="modules" name="sidebar-a" style="none" />
</div>
</div>
</div>
17 changes: 17 additions & 0 deletions pagelayout/2column-right.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
defined('_JEXEC') or die;
?>

<div class="container">
<div class="row">
<div class="col-sm-8 col-md-9">
<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<div class="col-sm-4 col-md-3">
<jdoc:include type="modules" name="sidebar-b" style="none" />
</div>
</div>
</div>
20 changes: 20 additions & 0 deletions pagelayout/3column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
defined('_JEXEC') or die;
?>

<div class="container">
<div class="row">
<div class="col-sm-3 col-md-2">
<jdoc:include type="modules" name="sidebar-a" style="none" />
</div>
<div class="col-sm-6 col-md-8">
<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />
</div>
<div class="col-sm-3 col-md-2">
<jdoc:include type="modules" name="sidebar-b" style="none" />
</div>
</div>
</div>
8 changes: 8 additions & 0 deletions pagelayout/homepage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
defined('_JEXEC') or die;
?>

<?php if(count(JFactory::getApplication()->getMessageQueue())):?>
<jdoc:include type="message" />
<?php endif; ?>
<jdoc:include type="component" />

0 comments on commit b8403dc

Please sign in to comment.