반응형
1. 디렉토리 구조 만들기
/website 디렉토리 안에 다운로드 받은 Template_ 파일들을 업로드한다.
2. 서브클래스 만들기
홈페이지 루트 디렉토리에 Template.class.php 라는 파일을 아래와 같이 작성하자.
주의!!! Template_.class.php 와 Template.class.php 을 혼동하지 말것
주의!!! new Template_ 와 new Template 을 혼동하지 말것.
자 이제 테스트 파일을 만들어 템플릿이 제대로 작동하는지 확인하다.
xtac.net에 자세한 설명이 나와있기는 하지만
조금 헷갈리는 부분과 착각 할 수 있는 부분들이 있어 정리하기로 하였다.
참고: http://xtac.net/reference/?item=config2
/website 디렉토리 안에 다운로드 받은 Template_ 파일들을 업로드한다.
2. 서브클래스 만들기
홈페이지 루트 디렉토리에 Template.class.php 라는 파일을 아래와 같이 작성하자.
주의!!! Template_.class.php 와 Template.class.php 을 혼동하지 말것
주의!!! new Template_ 와 new Template 을 혼동하지 말것.
<?php
include dirname(__file__).'/Template_.class.php';
class Template extends Template_
{
var $compile_check =true;
var $compile_ext ='php';
var $prefilter ='adjustPath';
function Template()
{
$this->template_dir='_global';
//$this->compile_dir =$_SERVER['DOCUMENT_ROOT'].'/compile';
$this->compile_dir ='compile';
$this->skin='skin1';
}
}
?>
자 이제 테스트 파일을 만들어 템플릿이 제대로 작동하는지 확인하다.
<?php
include 'Template.class.php'; // 주의!! 파일명 변경함.
$tpl = new Template; // 주의!! 상속 클래스로 변경함.
$tpl->define('index', 'index.tpl');
$tpl->assign(array(
'title' =>'First Template_',
'content'=>'Hello World!',
));
$tpl->print_('index');
?>
xtac.net에 자세한 설명이 나와있기는 하지만
조금 헷갈리는 부분과 착각 할 수 있는 부분들이 있어 정리하기로 하였다.
참고: http://xtac.net/reference/?item=config2
반응형
'프로그래밍' 카테고리의 다른 글
| Jquery ShowHide 테이블 Row (0) | 2009.08.29 |
|---|---|
| MySQL의 DateFormet (0) | 2009.08.27 |
| [Jquery] 텍스트 스크롤 (Text Scroll) - Scroll List (4) | 2009.08.01 |
| 웹 페이지 내의 모든 링크를 한 눈에 보여주는 방법 (0) | 2009.07.31 |
| [PHP] PEAR DB 사용하기 (0) | 2009.07.29 |