이것은 내 응용 프로그램에서 사용하는 것입니다. 이 도움이된다면보기 :
site_config.php : 이것은 내 템플릿 모습입니다
<?php
define('DIR_BASE', dirname(dirname(__FILE__)));
define('DIR_CLASSES', DIR_BASE . '/classes/');
// this is specific to the site
define('DIR_SITE', DIR_BASE . '/yoursite/');
define('SITE_NAME', 'yoursite');
// these would be specific to this site only
define('DIR_SITE_VIEWS', DIR_SITE . 'views/');
define('DIR_SITE_COMPONENTS', DIR_SITE . 'components/');
define('BASE_URL', 'http://'.$_SERVER['SERVER_NAME']);
define('SITE_URL', BASE_URL . '/yoursite');
// static content for the site
define('DIR_STATIC', SITE_URL . '/static');
define('DIR_JS', DIR_STATIC . '/js');
define('DIR_CSS', DIR_STATIC . '/css');
define('DIR_SITE_IMG', SITE_URL . '/images');
?>
같은 :
<?php
// site_template.php
// template for adding a new page directly under main directory of this site
require_once('site_config.php');
$pgtitle = "Title of the Page";
include_once(DIR_SITE_VIEWS . 'site_header_begin.php');
// custom css/javascript goes here
include_once(DIR_SITE_VIEWS . 'site_header_end.php');
?>
<?php
// main content of the page goes here
?>
<?php
include_once(DIR_SITE_VIEWS . 'site_footer.php');
?>
site_header_begin.php :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<?php if (isset($pgtitle) && ($pgtitle != '')){echo $pgtitle." :: ";}?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="AUTHOR" content="" />
<meta name="KEYWORDS" content="" />
<meta name="DESCRIPTION" content="" />
<!-- common css goes here -->
<script type="text/javascript" language="javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js"></script>
site_header_end.php :
</head><!-- end the header here -->
<body ><!-- start the body here -->
site_footer.php :
<div id="footer"><a name="pageFooter"></a>
</div>
</body>
</html>
이 머리글/바닥 글 "상수"를 동적으로 만들 것이며, 모든 것이 site_config.php 파일에 정의 된 상수로 정의됩니다. 적절한보기, 정적, 클래스 및 구성 요소 디렉토리를 추가하기 만하면됩니다. 이것이 도움이되는지 확인하십시오.
login.php
나는 일반적인 관행은 다음 각 페이지 –1 개 파일을 포함 할 필요가있다 "namespace.php"라는 파일을 생성하여 일반적으로 사용되는 모든 것을 포함 스틱 생각 덕분에 더 편리 해졌고 덕분에 –