Customising the full page layout based on path when using the language.module
Last modified: June 23, 2007 - 21:34
Description
This snippet allows you to customise the full page layout based on path when using the language.module. The arg(n) function doesn't work when the language module is enabled.
Thanks to BrendanHodge for contributing this snippet.
Step 1 of 2
- Make a copy of your page.tpl.php file and rename it to be page-default.tpl.php.
- Make further copies your page.tpl.php file it and rename them to be page-front.tpl.php, page-blog.tpl.php and page-book.tpl.php etc. as an example/.
- Using a text editor like notepad.exe or equivalent, modify the layout of each tpl.php file to suit your desires
- Upload your new page-type.tpl.php layout files to your active theme folder
Step 2 of 2
- Using a text editor like notepad.exe or equivalent, replace the contents of your page.tpl.php file with the snippet below
- Ensure that you have a page-default.tpl.php file as part of your collection of layouts.
- Upload your new page.tpl.php file to your active theme folder and your new layouts will take effect automatically
<?php
$uri_request_id = $_SERVER['REQUEST_URI'];
$section = explode("/", $uri_request_id);
switch ($section[1]) {
case 'layout1': include 'page-layout1.tpl.php'; break;
case 'layout2': include 'page-layout2.tpl.php'; break;
default: include 'page-default.tpl.php';
}
?>