smarty 간단 한 템 플 릿 변수 출력 방법<br>오리지널
config.inc.php 설정 파일 은 다음 과 같 습 니 다.
include_once('smarty/Smarty.class.php');
$smarty=new Smarty();
$smarty->config_dir="smarty/Config_File.class.php";
$smarty->caching=false; //
$smarty->template_dir="./templates"; //
$smarty->compile_dir="./templates_c"; //
$smarty->cache_dir="./smarty_cache"; //
$smarty->left_delimiter="<{";
$smarty->right_delimiter="}>";
index.php 파일 은 다음 과 같 습 니 다.
include('./config.inc.php');
$title="php ";
$content="smarty !";
$newstext[]=array("name"=>"php ","date"=>"2015-08-01");
$newstext[]=array("name"=>"php ","date"=>"2015-08-02");
$newstext[]=array("name"=>"smarty ","date"=>"2015-08-03");
$row=array(" "," "," ");
$smarty->assign("title",$title);
$smarty->assign("row",$row);//
$smarty->assign("shownewstext",$newstext);//
$smarty->assign("content",$content);
$smarty->display('index.htm');
실행 결 과 는 다음 과 같 습 니 다.
: | |
--------------------------------------------------------------------------------
:smarty !
:
php - 2015-08-01
php - 2015-08-02
smarty - 2015-08-03
본 고 에서 말 한 것 이 스마트 템 플 릿 을 바탕 으로 하 는 phop 프로 그래 밍 에 어느 정도 도움 이 되 기 를 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
스마트 빠 른 입문Smarty 는 PHP 로 작 성 된 템 플 릿 엔진 으로 현재 업계 에서 가장 유명한 PHP 템 플 릿 엔진 중 하나 이다.이 는 논리 코드 와 외재 적 인 내용 을 분리 하여 관리 하고 사용 하기 쉬 운 방법 을...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.