1.smartyåmvcå¨å·¥ä½ä¸åºç¨çå¤å
2.为ä»ä¹ä½¿ç¨smarty
smartyåmvcå¨å·¥ä½ä¸åºç¨çå¤å
smarty
1. é度ï¼éç¨Smartyç¼åçç¨åºå¯ä»¥è·å¾æ大é度çæé«ï¼è¿ä¸ç¹æ¯ç¸å¯¹äºå ¶å®ç模æ¿å¼æææ¯èè¨çã
2. ç¼è¯åï¼éç¨Smartyç¼åçç¨åºå¨è¿è¡æ¶è¦ç¼è¯æä¸ä¸ªé模æ¿ææ¯çPHPæ件ï¼è¿ä¸ªæ件éç¨äºPHPä¸HTMLæ··åçæ¹å¼ï¼å¨ä¸ä¸æ¬¡è®¿é®æ¨¡æ¿æ¶å°WEB请æ±ç´æ¥è½¬æ¢å°è¿ä¸ªæ件ä¸ï¼èä¸åè¿è¡æ¨¡æ¿éæ°ç¼è¯ï¼å¨æºç¨åºæ²¡ææ¹å¨çæ åµä¸ï¼ å»é¤äºé»è¾å¤çæ带æ¥çå·¥ä½éï¼ä¿è¯äºç½ç«çæµè§é度ã
3. ç¼åææ¯ï¼Smartyéç¨çä¸ç§ç¼åææ¯ï¼å®å¯ä»¥å°ç¨æ·æç»çå°çHTMLæ件ç¼åæä¸ä¸ªéæçHTML页ï¼å½è®¾å®Smartyçcacheå±æ§ä¸ºtrueæ¶ï¼å¨Smarty设å®çcachetimeæå å°ç¨æ·çWEB请æ±ç´æ¥è½¬æ¢å°è¿ä¸ªéæçHTMLæ件ä¸æ¥ï¼è¿ç¸å½äºè°ç¨ä¸ä¸ªéæçHTMLæ件ã å¾å¥½ç解å³äºå 访é®éè¿å¤§é æçæå¡åºç¹å¿ï¼å ç¨èµæºå¤§çé®é¢ï¼å æ¤ç»ç½ç«è®¿é®è æä¾äºå¿«éç访é®é度ã
4. æ件ææ¯ï¼Smartyå¯ä»¥èªå®ä¹æ件ãæ件å®é å°±æ¯ä¸äºèªå®ä¹çå½æ°ã
5. 模æ¿ä¸å¯ä»¥ä½¿ç¨if/elseif/else/endifãå¨æ¨¡æ¿æ件使ç¨å¤æè¯å¥å¯ä»¥é常æ¹ä¾¿ç对模æ¿è¿è¡æ ¼å¼éæã
ä¸éå使ç¨Smartyçå°æ¹
1. éè¦å®æ¶æ´æ°çå 容ãä¾å¦åè¡ç¥¨æ¾ç¤ºï¼å®éè¦ç»å¸¸å¯¹æ°æ®è¿è¡æ´æ°ï¼å¯¼è´ç»å¸¸éæ°ç¼è¯æ¨¡æ¿ï¼æ以è¿ç±»åçç¨åºä½¿ç¨Smartyä¼ä½¿æ¨¡æ¿å¤çé度åæ ¢ã
2. å°é¡¹ç®ãå°é¡¹ç®å 为项ç®ç®åèç¾å·¥ä¸ç¨åºåå ¼äºä¸äººç项ç®ï¼ä½¿ç¨Smartyä¼å¨ä¸å®ç¨åº¦ä¸ä¸§å¤±PHPå¼åè¿ éçä¼ç¹ã
ä»ä¹æ¯MVC?模板y模取gzip网页源码
è¯è¯´Nå¤å¹´åï¼å¨ä¸ä¸ªå«SmartTalkçå½åº¦åºç°äºä¸ä¸ªå«MVCç家ä¼ï¼åæ¥æµçªå°äºjavaå½ï¼å¨Javaå½éå¼é£å¤é¨ï¼javaçå¾å¤æçé¢çç»ä»¶ï¼æ¯å¦swingé½æ¯éç¨MVC模å¼è®¾è®¡çï¼ã
é¦å ï¼æ¤äººé¿äºä¸åªæãä¸åªå«Modelï¼å®è´è´£ä¸å¡é¢åç¶æçç¥è¯ï¼ä¸åªå«Viewï¼è´è´£ä¸å¡é¢åç表示è§å¾ï¼ä¸åªå«Controllerï¼è´è´£æ§å¶ç¨æ·è¾å ¥çæµåç¶æãå½æ¨¡åæä¸é¨ååçååçæ¶åï¼é常使ç¨äºä»¶éç¥è¡¨åæ¥éç¥è§å¾ãä½æ¯è¿ä¸ªå®¶ä¼å¨Webä¸æä½çæ¶åéå°äºéº»ç¦ãå 为Webçæµè§å¨æ¯æ²¡æç¶æçï¼æ以模å没æåæ³éç¥è§å¾åçååï¼èå¿ é¡»éè¿ç¨æ·ååºå¦ä¸æ¬¡è¯·æ±æè½ç¥é模åçæ¹åãï¼ä»¥ä¸å 容æºèªãjakarta strutsç¼ç¨ãä¸ä¹¦ï¼
å¨jsp2.0è§èä¸ï¼JavaçMVCä¸å 许ç´æ¥è¯·æ±jsp页é¢èæ¯éè¦éè¿Servletæ¥éå®åï¼å ·ä½çææå ä¸è¯´ï¼èµ·ç åæ¯æControlleråViewåå¼äºï¼èä¸ä¹ç»ä¸äºå ¥å£ï¼é½æ¯ä»æ§å¶å¨è¿å ¥çï¼é£ä¹æ§å¶å¨çèè´£ä¹å°±å¾æ¸ æ°äºï¼
æ¦æªpiles once.ä¸éè¦å¤ä½ç模æ¿è¯æ³è§£æ,ä» ä» æ¯ç¼è¯ä¸æ¬¡
It is smart about recompiling only the template files that have changed.
ä» å¯¹ä¿®æ¹è¿ç模æ¿æ件è¿è¡éæ°ç¼è¯
You can make custom functions and custom variable modifiers, so the template language is extremely extensible.
å¯ä»¥ç¼è¾'èªå®ä¹å½æ°'åèªå®ä¹'åé',å æ¤è¿ç§æ¨¡æ¿è¯è¨å®å ¨å¯ä»¥æ©å±
Configurable template delimiter tag syntax, so you can use { }, { { }}, <!--{ }-->, etc.
å¯ä»¥èªè¡è®¾ç½®æ¨¡æ¿å®ç符,æä»¥ä½ å¯ä»¥ä½¿ç¨{ }, { { }}, <!--{ }-->, çç
The if/elseif/else/endif constructs are passed to the PHP parser, so the { if ...} expression syntax can be as simple or as complex as you like.
è¯¸å¦ if/elseif/else/endif è¯å¥å¯ä»¥è¢«ä¼ éå°phpè¯æ³è§£æå¨,æ以 { if ...} 表达å¼æ¯ç®åçæè æ¯å¤åç,éä½ å欢å¦
Unlimited nesting of sections, ifs, etc. allowed.
å¦æå 许çè¯,sectionä¹é´å¯ä»¥æ éåµå¥
It is possible to embed PHP code right in your template files, although this may not be needed (nor recommended) since the engine is so customizable.
å¼ææ¯å¯ä»¥å®å¶ç.å¯ä»¥å åµphp代ç å°ä½ ç模æ¿æ件ä¸,è½ç¶è¿å¯è½å¹¶ä¸éè¦(ä¸æ¨è)
Built-in caching support
å 建ç¼åæ¯æ
Arbitrary template sources
ç¬ç«æ¨¡æ¿æ件
Custom cache handling functions
å¯èªå®ä¹ç¼åå¤çå½æ°
Plugin architecture
æ件ä½ç³»ç»æ