MVC开发模式以及Smarty模板引擎的使用
发布时间:2020-12-26 07:31:02 所属栏目:安全 来源:网络整理
导读:Linux 全局安装 composer 将目录切换到/usr/local/bin/ 目录 cd /usr/local/bin/ 在 bin 目录中下载 composer curl -sS https: // getcomposer.org/installer | php 通过 composer.phar - v 查看 composer修改为中国镜像 composer.phar config -g repo.packa
变量修饰器的使用modifier.html >变量修饰器的使用 {$str="123123nthIs is string."} {$str|capitalize:true:true} {$str|capitalize:true:true|cat:'.'} {$str|count_characters} {$str|count_paragraphs} {$str|count_sentences} {$str|count_words} {$str2|default:'Not Data Yet'} {time()|date_format:'%Y-%m-%d %H:%M:%S'} {$chinese = '中文'} {$chinese|from_charset:'utf-8'|to_charset:'gb2312'} {$str|indent:10:'---'} {$str|lower|upper} {$str2="This is p1.nThis is p2."} {$str2|nl2br} {$str|regex_replace:'/d+/':' '} {$str|replace:'123123':'000'} {$str|spacify:'-'} {$float='10.0020398475'} {$float|string_format:'%.2f'} {$str3='a b c'} {$str3|strip:'-'} {$tag='b>Font'} {$tag|strip_tags} {$bigstr='123123123123123123ahjfdashfksdhfkjsdhjkfshfjkhsd'} {$bigstr|truncate:10:'---':true:true} {$tag|escape|unescape} {$bigstr|wordwrap:10:"n":true} > 块函数的使用block_func.html >块函数的使用 {textformat indent='4' indent_first='10' indent_char='-' wrap='10' wrap_char='' wrap_cut=true assign='var'} aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa {/textformat} {*$var*} {nocache} {time()} {/nocache} {time()} > 插件的开发plugins.html {font text=$text color='#123123'} {$text|link:'http://www.baidu.com'} {link href='http://www.baidu.com'} aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa {/link} > Smarty模板引擎插件的开发: 2、在smarty模板的libs/plugins/目录下创建函数插件文件 block.link.php function smarty_block_link() { ]; )) { ; } } function.font.php function smarty_function_font(]; ; ; } modifier.link.php function smarty_modifier_link() { ); } ; } 模板继承的使用 !-- 使用{extends}函数实现模板继承 合并子模板和父模板的{block}标签内容 --> {extends file="layout.html"} {block name="title"} Article {$smarty.block.parent} {/block} {block name="content"} Article List {$smarty.get.page} {*nocache*} {time()} {*/nocache*} {time()|date_format:'%H:%M:%S' nocache} {/block} layout.html >{block name="title"} - Imooc{/block}header menu {block name="content"}{/block} footer copyright > 缓存机制 相关函数 (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |