| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> zai PHP zhong ru he shi yong mo ban

zai PHP zhong ru he shi yong mo ban

2008-12-22 08:10:45 编辑來源:互联网 评论
 
 
 
本文为【在PHP中如何使用模板】的拼音翻译版
  shi fou ni mian lin zhe chuang jian you yi ge bian cheng ren yuan ( ke neng jiu shi ni ) he yi ge she ji ren yuan tong shi jin xing chuang zuo de wang zhan ? ni bu zhi dao ru he shi gong zuo dui ni liang lai shuo bian de rong yi ma ? wo lai gei ni da an : shi yong FastTemplate lai shi ni de zhan dian geng rong yi ding zhi !
  hao le , ni ke neng xiang zhi dao wei shen me ni yao shi yong FastTemplates。
  · ke yi zai ji miao zhong gai bian ni de zheng ge zhan dian de wai guan
  · chou xiang cheng xu she ji , mei you la ji HTML dai ma
  · she ji ren yuan bu xu yao guan xin quan bu de " mo hu " dai ma
  · ling ren jing ya di kuai
  · geng rong yi chong yong jiu de mo ban ( dui pu tong de biao dan er shuo )
  FastTemplate yuan yu yi ge you tong yang ming cheng de Perl ruan jian bao ( ke yi zai CPAN shang zhao dao )。 ni ke yi xia zai PHP de ban ben cong ta de zhu ye ( ben zhan xia zai di zhi wei :http://www.phpe.net/downloads/1.shtml)。 ni zhi xu yao qi zhong de yi ge lei de wen jian (class.FastTemplate.php)。
  rang wo shou xian jie shi yi xia zai shi yong mo ban sheng cheng yi ge ye mian yu jian dan di tong guo echo huo print jiang ye mian shu chu zhi jian you shen me bu tong ba 。
  jian dan di shi yong echo/print de fang fa hen shi he bian xie duan de jiao ben , dan shi bu neng bang zhu ni geng hao de zu zhi he ding zhi 。 mo ban zai ling yi fang mian gei
  le ni chuang jian duo guo yu yan zhan dian de neng li , zhi shi tong guo gai dong yi ge shen shu 。 ta men ke yi cu shi ni geng guan xin ni yao zuo de 。
  zai kai shi bian ma zhi qian bu yao hai pa si kao 。 ta ke neng hui hua fei yi xie shi jian , dan shi zhe xie hua fei hui sui zhe xiang mu de fa zhan dui ni you suo hui bao 。
  na me , ru he ying yong FastTemplate ne ? shou xian ni xu yao xian jin xing yi ge jian dan di tiao yong :
  <?php $tpl=new FastTemplate ("path");
  ?>
  chuan di gei ta yi ge lu jing , shi suo you ni de mo ban wen jian cun fang de mu lu 。 ta fan hui yi ge dui xiang , ni ke yi yong ta jin xing shen
  shu fu zhi , sheng cheng ye mian deng deng 。
  FastTemplate shi ji yu zhe yang yi zhong jia she : yi ge hen da de ye mian shi you hen duo xiao de bu fen zu cheng de 。 mei yi ge bu fen you yi ge wei yi
  de ming zi 。 zui xiao de bu fen shi fu zhi gei zhe yang you zhe wei yi ming zi de yi duan zheng chang de wen ben zi fu chuan 。 zhe ge ke yi tong guo <?php
  $tpl->assign(NAME, "text");
  ?>
  lai wan cheng 。 xian zai , ru guo ni de yi ge mo ban bao han {NAME},FastTemplate jiu zhi dao ni
  de yi tu le 。
  ling wai ,FastTemplate xu yao zhi dao ni xiang ru he tiao yong ni de mo ban 。 ni xu yao tong guo chuan di yi ge xiang guan shu zu (associative
  array) gei <?php $tpl->define(); ?>
  lai gei ta yi ge ti shi 。
  <?php
  $tpl->define(array(foo => "foo.tpl",
  bar => "bar.tpl"));
  ?>
  zhe xie fu zhi jiang fen bie gei foo he bar yi bu tong de wen jian ( ming wei foo.tpl he bar.tpl)。
  xian zai ni xiang rang FastTemplate ti huan zai mo ban foo zhong de suo you {MACROS} wei xiang ying de zhi 。 tong guo fa chu ming ling
  <?php
  $tpl->parse(PAGECONTENT, "foo");
  ?>
  lai shi xian 。 zhe ge ming ling jiang ba mo ban "foo" de nei rong fu gei PAGECONTENT。 dang ran , wo men huan mei you zuo wan , yin wei mo ban bar zhong wei zhu yao de ye mian ding yi ,FastTemplate xu yao ti huan qi zhong de
  {PAGECONTENT} hong 。 wo men ye xu yao gei PAGETITLE fu zhi , ru xia suo zuo : <?php
  $tpl->assign(PAGETITLE, "FooBar test");
  $tpl->parse(MAIN, "bar");
  ?>
  rong yi ba , bu shi ma ? wo men xian zai zhi xu yao ba ta shu chu : <?php
  $tpl->FastPrint(MAIN);
  ?>
  xia mian san ge wen jian xian shi le shi ji lian xi zhong de geng duo de xi jie miao shu 。 wo bu zhi dao zai xian shi sheng huo le li le zhe ge ji shu ying ru he sheng huo --
  ni de she ji zhe hui gao xing , ni de lao ban hui wei xiao , yin wei ni ke yi zai geng duan de shi jian nei zuo geng duo de shi qing 。
  bar.tpl <!-- bar.tpl -->
  <HTML>
  <HEAD><TITLE>Feature world - {PAGETITLE}</TITLE></HEAD>
  <BODY BGCOLOR=BLACK TEXT=WHITE>
  <H1>{PAGETITLE}</H1>
  {PAGECONTENT}
  </BODY>
  </HTML>
  foo.tpl <!-- foo.tpl -->
  hen ming xian shi shen me dou mei zuo 。 qing kan {NAME}.
  demo.php3 <?php
  include "class.FastTemplate.php3";
  $tpl = new FastTemplate( ".");
  $tpl->define(array(foo => "foo.tpl", bar => "bar.tpl"));
  $tpl->assign(NAME, "me");
  $tpl->assign(PAGETITLE, "Welcome!");
  $tpl->parse(PAGECONTENT, "foo");
  $tpl->parse(MAIN, "bar");
  $tpl->FastPrint(MAIN);
  ?>
  chuang jian zheng ge biao ge
  wo ye xie le yi ge duan de li zi , yong lai yan shi ru he tong guo dan xing mo ban lai sheng cheng zheng ge biao ge 。 ta hen you xiao , yin wei ni reng ran bu xu yao zhi
  jie xiu gai HTML wen dang 。
  wo men zeng jia yi ge mo ban de nei rong dao yi ge yi jing ding yi guo de wei yi ming ming de hou mian lai chuang jian HTML biao ge 。 zhe ge ke yi tong guo zai tiao yong
  $tpl->parse() shi , zai mo ban ming qian jia shang yi ge "." lai shi xian 。 <?php
  // jiang mo ban foo de nei rong fu gei TPL1
  $tpl->parse(TPL1, "foo");
  // zai TPL1 hou fu shang mo ban bar de nei rong
  $tpl->parse(TPL1, ".bar");
  ?>
  page.tpl
  <HTML>
  <HEAD><TITLE>Feature world - {PAGE_TITLE}</TITLE></HEAD>
  <BODY BGCOLOR=BLACK TEXT=WHITE>
  <H1>{PAGE_TITLE}</H1>
  {PAGE_CONTENT}
  </BODY>
  </HTML>
  table.tpl
  <TABLE>
  <TR> <TH>name</TH> <TH>size</TH> </TR>
  {TABLE_ROWS}
  </TABLE>
  table_row.tpl
  <TR>
  <TD>{FILENAME}</TD>
  <TD>{FILESIZE}</TD>
  </TR>
  yad.php3
  <?php
  include "class.FastTemplate.php3";
  function InitializeTemplates() {
  global $tpl;
  $tpl = new FastTemplate( ".");
  $tpl->define( array( page => "page.tpl",
  table => "table.tpl",
  table_row => "table_row.tpl" ) );
  }
  function ReadCurrentDirectory() {
  global $tpl;
  $handle = opendir( ".");
  while($filename = readdir($handle)) {
  $tpl->assign(FILENAME, $filename);
  $tpl->assign(FILESIZE, filesize($filename));
  $tpl->parse(TABLE_ROWS, ".table_row");
  }
  closedir($handle);
  $tpl->parse(PAGE_CONTENT, "table");
  }
  function PrintPage($title) {
  global $tpl;
  $tpl->assign(PAGE_TITLE, $title);
  $tpl->parse(FINAL, "page");
  $tpl->FastPrint(FINAL);
  }
  InitializeTemplates();
  ReadCurrentDirectory();
  Printpage( "Yet Another Demo");
  ?>
  su du tao lun
  "Ok," ni ke neng hui shuo ," yi qie dou tai hao le 。 dan shi ta bu hui ying xiang wo de wang zhan de su du ma ?"
  bu , ni de wang zhan ke neng bian de geng kuai 。 yi ge jian dan de yuan yin jiu shi : yin wei ni zuo wei yi ge bian cheng ren yuan guan xin de shi she ji ni de ying yong he bian xie dai ma , ni de dai ma jiang hui geng you xiao lv , chu li xiang tong de ren wu geng rong yi he geng kuai su 。 suo yi , ni ke neng hui zai shang mian lie chu de wei shen me kao lv shi yong FastTemplate zai ni de xiang mu zhong de yuan yin lie biao zhong zeng jia ling yi tiao li you 。
  ru guo ni zhi shi xiang zhuan huan yi ge yi jing cun zai de web zhan dian , xing neng shang de cheng gong ke neng bu hui bei zhu yi dao 。 wo jian yi zai PHP zhong shi yong zheng ze biao da shi huan chong , ta jiang dui zhe zhong qing kuang you suo bang zhu 。 yin wei FastTemplate dui mei yi ge hong dou shi yong zheng ze biao da shi , mei yi ge zheng ze biao da shi jiang bei zhi bian yi yi ci bing qie su du shang de ying xiang ke yi hu lue bu ji 。【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
shi fou ni mian lin zhe chuang jian you yi ge bian cheng ren yuan ( ke neng jiu shi ni ) he yi ge she ji ren yuan tong shi jin xing chuang zuo de wang zhan ? ni bu zhi dao ru he shi gong zuo dui ni liang lai shuo bian de rong yi ma ? wo lai gei ni da an : shi yong FastTemplate lai shi ni de zhan dian geng rong yi ding zhi !    hao le , ni ke neng xiang zhi dao wei shen me ni yao shi yong FastTemplates。 · ke yi zai ji miao zhong gai bian ni de zheng ge zhan dian de wai guan · chou xiang cheng xu she ji , mei you la ji HTML dai ma · she ji ren yuan bu xu yao guan xin quan bu de " mo hu " dai ma · ling ren jing ya di kuai · geng rong yi chong yong jiu de mo ban ( dui pu tong de biao dan er shuo )   FastTemplate yuan yu yi ge you tong yang ming cheng de Perl ruan jian bao ( ke yi zai CPAN shang zhao dao )。 ni ke yi xia zai PHP de ban ben cong ta de zhu ye ( ben zhan xia zai di zhi wei :http://www.phpe.net/downloads/1.shtml)。 ni zhi xu yao qi zhong de yi ge lei de wen jian (class.FastTemplate.php)。    rang wo shou xian jie shi yi xia zai shi yong mo ban sheng cheng yi ge ye mian yu jian dan di tong guo echo huo print jiang ye mian shu chu zhi jian you shen me bu tong ba 。 jian dan di shi yong echo/print de fang fa hen shi he bian xie duan de jiao ben , dan shi bu neng bang zhu ni geng hao de zu zhi he ding zhi 。 mo ban zai ling yi fang mian gei le ni chuang jian duo guo yu yan zhan dian de neng li , zhi shi tong guo gai dong yi ge shen shu 。 ta men ke yi cu shi ni geng guan xin ni yao zuo de 。    zai kai shi bian ma zhi qian bu yao hai pa si kao 。 ta ke neng hui hua fei yi xie shi jian , dan shi zhe xie hua fei hui sui zhe xiang mu de fa zhan dui ni you suo hui bao 。    na me , ru he ying yong FastTemplate ne ? shou xian ni xu yao xian jin xing yi ge jian dan di tiao yong : <?php $tpl=new FastTemplate ("path"); ?> chuan di gei ta yi ge lu jing , shi suo you ni de mo ban wen jian cun fang de mu lu 。 ta fan hui yi ge dui xiang , ni ke yi yong ta jin xing shen shu fu zhi , sheng cheng ye mian deng deng 。   FastTemplate shi ji yu zhe yang yi zhong jia she : yi ge hen da de ye mian shi you hen duo xiao de bu fen zu cheng de 。 mei yi ge bu fen you yi ge wei yi de ming zi 。 zui xiao de bu fen shi fu zhi gei zhe yang you zhe wei yi ming zi de yi duan zheng chang de wen ben zi fu chuan 。 zhe ge ke yi tong guo <?php $tpl->assign(NAME, "text"); ?> lai wan cheng 。 xian zai , ru guo ni de yi ge mo ban bao han {NAME},FastTemplate jiu zhi dao ni de yi tu le 。    ling wai ,FastTemplate xu yao zhi dao ni xiang ru he tiao yong ni de mo ban 。 ni xu yao tong guo chuan di yi ge xiang guan shu zu (associative array) gei <?php $tpl->define(); ?> lai gei ta yi ge ti shi 。 <?php $tpl->define(array(foo => "foo.tpl", bar => "bar.tpl")); ?>    zhe xie fu zhi jiang fen bie gei foo he bar yi bu tong de wen jian ( ming wei foo.tpl he bar.tpl)。    xian zai ni xiang rang FastTemplate ti huan zai mo ban foo zhong de suo you {MACROS} wei xiang ying de zhi 。 tong guo fa chu ming ling <?php $tpl->parse(PAGECONTENT, "foo"); ?> lai shi xian 。 zhe ge ming ling jiang ba mo ban "foo" de nei rong fu gei PAGECONTENT。    dang ran , wo men huan mei you zuo wan , yin wei mo ban bar zhong wei zhu yao de ye mian ding yi ,FastTemplate xu yao ti huan qi zhong de {PAGECONTENT} hong 。 wo men ye xu yao gei PAGETITLE fu zhi , ru xia suo zuo : <?php $tpl->assign(PAGETITLE, "FooBar test"); $tpl->parse(MAIN, "bar"); ?>    rong yi ba , bu shi ma ? wo men xian zai zhi xu yao ba ta shu chu : <?php $tpl->FastPrint(MAIN); ?>    xia mian san ge wen jian xian shi le shi ji lian xi zhong de geng duo de xi jie miao shu 。 wo bu zhi dao zai xian shi sheng huo le li le zhe ge ji shu ying ru he sheng huo -- ni de she ji zhe hui gao xing , ni de lao ban hui wei xiao , yin wei ni ke yi zai geng duan de shi jian nei zuo geng duo de shi qing 。 bar.tpl <!-- bar.tpl --> <HTML> <HEAD><TITLE>Feature world - {PAGETITLE}</TITLE></HEAD> <BODY BGCOLOR=BLACK TEXT=WHITE> <H1>{PAGETITLE}</H1> {PAGECONTENT} </BODY> </HTML> foo.tpl <!-- foo.tpl --> hen ming xian shi shen me dou mei zuo 。 qing kan {NAME}. demo.php3 <?php include "class.FastTemplate.php3"; $tpl = new FastTemplate( "."); $tpl->define(array(foo => "foo.tpl", bar => "bar.tpl")); $tpl->assign(NAME, "me"); $tpl->assign(PAGETITLE, "Welcome!"); $tpl->parse(PAGECONTENT, "foo"); $tpl->parse(MAIN, "bar"); $tpl->FastPrint(MAIN); ?> chuang jian zheng ge biao ge    wo ye xie le yi ge duan de li zi , yong lai yan shi ru he tong guo dan xing mo ban lai sheng cheng zheng ge biao ge 。 ta hen you xiao , yin wei ni reng ran bu xu yao zhi jie xiu gai HTML wen dang 。    wo men zeng jia yi ge mo ban de nei rong dao yi ge yi jing ding yi guo de wei yi ming ming de hou mian lai chuang jian HTML biao ge 。 zhe ge ke yi tong guo zai tiao yong $tpl->parse() shi , zai mo ban ming qian jia shang yi ge "." lai shi xian 。 <?php // jiang mo ban foo de nei rong fu gei TPL1 $tpl->parse(TPL1, "foo"); // zai TPL1 hou fu shang mo ban bar de nei rong $tpl->parse(TPL1, ".bar"); ?> page.tpl <HTML> <HEAD><TITLE>Feature world - {PAGE_TITLE}</TITLE></HEAD> <BODY BGCOLOR=BLACK TEXT=WHITE> <H1>{PAGE_TITLE}</H1> {PAGE_CONTENT} </BODY> </HTML> table.tpl <TABLE> <TR> <TH>name</TH> <TH>size</TH> </TR> {TABLE_ROWS} </TABLE> table_row.tpl <TR> <TD>{FILENAME}</TD> <TD>{FILESIZE}</TD> </TR> yad.php3 <?php include "class.FastTemplate.php3"; function InitializeTemplates() { global $tpl; $tpl = new FastTemplate( "."); $tpl->define( array( page => "page.tpl", table => "table.tpl", table_row => "table_row.tpl" ) ); } function ReadCurrentDirectory() { global $tpl; $handle = opendir( "."); while($filename = readdir($handle)) { $tpl->assign(FILENAME, $filename); $tpl->assign(FILESIZE, filesize($filename)); $tpl->parse(TABLE_ROWS, ".table_row"); } closedir($handle); $tpl->parse(PAGE_CONTENT, "table"); } function PrintPage($title) { global $tpl; $tpl->assign(PAGE_TITLE, $title); $tpl->parse(FINAL, "page"); $tpl->FastPrint(FINAL); } InitializeTemplates(); ReadCurrentDirectory(); Printpage( "Yet Another Demo"); ?> su du tao lun   "Ok," ni ke neng hui shuo ," yi qie dou tai hao le 。 dan shi ta bu hui ying xiang wo de wang zhan de su du ma ?"    bu , ni de wang zhan ke neng bian de geng kuai 。 yi ge jian dan de yuan yin jiu shi : yin wei ni zuo wei yi ge bian cheng ren yuan guan xin de shi she ji ni de ying yong he bian xie dai ma , ni de dai ma jiang hui geng you xiao lv , chu li xiang tong de ren wu geng rong yi he geng kuai su 。 suo yi , ni ke neng hui zai shang mian lie chu de wei shen me kao lv shi yong FastTemplate zai ni de xiang mu zhong de yuan yin lie biao zhong zeng jia ling yi tiao li you 。    ru guo ni zhi shi xiang zhuan huan yi ge yi jing cun zai de web zhan dian , xing neng shang de cheng gong ke neng bu hui bei zhu yi dao 。 wo jian yi zai PHP zhong shi yong zheng ze biao da shi huan chong , ta jiang dui zhe zhong qing kuang you suo bang zhu 。 yin wei FastTemplate dui mei yi ge hong dou shi yong zheng ze biao da shi , mei yi ge zheng ze biao da shi jiang bei zhi bian yi yi ci bing qie su du shang de ying xiang ke yi hu lue bu ji 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
玉美人_珠联璧合
清纯美女米卡
清新靓丽的早晨
玲子的自信与性感
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有