/** * @param string $include * @param string $page (optional) */ function include_template_part($include, $page = "") { global $pwt; if (!file_exists(dirname(__FILE__) . "/tpl/{$include}.php")) { trigger_error("Template {$include}.php not found.", E_USER_WARNING); return; } $page = $page === "" ? get_current_page() : explode("/", $page); $home = get_relative_home_path($page); include dirname(__FILE__) . "/tpl/{$include}.php"; }
<?php require_once dirname(__FILE__) . "/common/php/init.php"; $home = get_relative_home_path(get_current_page()); ?> <!doctype html> <html lang="ja"> <head> <meta charset="UTF-8" /> <title><?php echo SN; ?> </title> <?php include_template_part("head"); ?> <link rel="stylesheet" href="css/index.css" /> <script src="js/index.js"></script> </head> <body> <div id="wrapper"> <?php include_template_part("header"); ?> <div id="main"> <h2 class="fz24 fwb">Index</h2> <ul class="mt10"> <li>- <a href="<?php echo $home; ?>