Skip to content

Instantly share code, notes, and snippets.

@jasonhazel
Created July 26, 2012 23:13
Show Gist options
  • Save jasonhazel/3185172 to your computer and use it in GitHub Desktop.
Save jasonhazel/3185172 to your computer and use it in GitHub Desktop.
<?php
$template_path = 'pages/public/';
$main_template = 'main.tmpl';
if(isset($_GET['p']))
$file = basename($_GET['p']) . '.tmpl';
else
$file = 'default.tmpl';
$template_variables = new stdClass;
$template_variables->contents = include($template_path . $file);
// You could add additional variables.
// $template_variables->page_title = 'Blah blah blah';
include($template_path . $main_template);
?>
<html>
<head>
<title><?= $template_variables->page_title ?></title>
</head>
<body>
<?= $template_variables->contents ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment