One powerful trick to improving the way a drupal site flows is switching page templates when certain PHP arguments return true. This is a quick tutorial on how to do that.
Step One: make three copies of page.tpl.php and the name them "frontpage.tpl.php", "admin.tpl.php", and "inside.tpl.php".
Step Two: Open page.tpl.php with an editor. Erase everything.. and I do mean everything, we're building this from the ground up. (get the coffee ready)
Step Three: copy the following code into page.tpl.php:
<?phpif (arg(0) == 'admin') { include "admin.tpl.php";} if ($is_front) { include "frontpage.tpl.php"; return;}else { include "inside.tpl.php";?>
Step Four:Test to make sure that indeed your different templates are
1. admin pages, 2. the front page, 3. and all other pages.Step Five: Use these methods, love these methods, and cherish these methods.
Notes: If your curious as to what arg(0) does, add this code somewhere in your body.
<?php$satan = arg(0);$gwbush = arg(1);$karlrove = arg(2);print $satan;print "<br />";print $gwbush;print "<br />";print $karlrove;print "<br />";?>Click around, and you'll figure it out.
Comments
<?php$satan =
<?php$satan = arg(0);
$gwbush = arg(1);
$karlrove = arg(2);
print $satan;
print "<br />";
print $gwbush;
print "<br />";
print $karlrove;
print "<br />";
?>
where to add this code
I have added in admin.tpl.php
but I have not seen any changes.
great tip, and slight correction
<?phpif (arg(0) == 'admin') { include "admin.tpl.php"; return;} if ($is_front) { include "frontpage.tpl.php"; return;}else { include "inside.tpl.php";}?>its a bit inflexible
Post new comment