phpcms2008 代码简介:模板解析(2)
2009-08-17 15:42
246 查看
看了一下首页,想看它是怎么解析的。
流程是
index.php = > function template('phpcms', 'index'); =>function template_compile() =>template /default/phpcms/index.html =>template_parse ()
示例:
如 template /default/phpcms/index.html 中的 {tag_首页幻灯片} ,首先将这个内容标签解析成 get_tag('首页幻灯片');然后再解析成 template/default/tag.inc.php中的 array('首页幻灯片')并返回以下值
'首页幻灯片' => 'tag(/'phpcms/', /'tag_content_slide/', "SELECT a.contentid,a.catid,a.typeid,a.areaid,a.title,a.style,a.thumb,a.keywords,a.description,a.userid,a.updatetime,a.inputtime,a.url FROM `phpcms_content` a, `phpcms_content_position` p WHERE a.contentid=p.contentid AND p.posid=2 AND a.status=99 AND `thumb`!=/'/' ORDER BY a.contentid DESC", 0, 5, array ( /'class/' => /'url/', /'target/' => /'_blank/', /'width/' => /'296/', /'height/' => /'164/',))',
然后得到 data/cache_template/phpcms_index.tpl.php编译后的文件;
而其中幻灯片的<?php echo tag('phpcms', 'tag_content_slide', ....);?> 将include/global.func.php 中的function tag()将解析其中的sql语句并得到数据$data及$pages,
最后调用标签模板 template/default/phpcms/tag_content_slide.html
流程是
index.php = > function template('phpcms', 'index'); =>function template_compile() =>template /default/phpcms/index.html =>template_parse ()
示例:
如 template /default/phpcms/index.html 中的 {tag_首页幻灯片} ,首先将这个内容标签解析成 get_tag('首页幻灯片');然后再解析成 template/default/tag.inc.php中的 array('首页幻灯片')并返回以下值
'首页幻灯片' => 'tag(/'phpcms/', /'tag_content_slide/', "SELECT a.contentid,a.catid,a.typeid,a.areaid,a.title,a.style,a.thumb,a.keywords,a.description,a.userid,a.updatetime,a.inputtime,a.url FROM `phpcms_content` a, `phpcms_content_position` p WHERE a.contentid=p.contentid AND p.posid=2 AND a.status=99 AND `thumb`!=/'/' ORDER BY a.contentid DESC", 0, 5, array ( /'class/' => /'url/', /'target/' => /'_blank/', /'width/' => /'296/', /'height/' => /'164/',))',
然后得到 data/cache_template/phpcms_index.tpl.php编译后的文件;
而其中幻灯片的<?php echo tag('phpcms', 'tag_content_slide', ....);?> 将include/global.func.php 中的function tag()将解析其中的sql语句并得到数据$data及$pages,
最后调用标签模板 template/default/phpcms/tag_content_slide.html
相关文章推荐
- phpcms2008 代码简介:模板
- 如何简化php模板页面中分页代码的解析
- XML解析技术之VTD-XML 简介及代码实例
- XML解析技术之VTD-XML 简介及代码实例
- phpcms2008 代码简介 缓存:include/cache.func.php
- phpcms2008 代码简介:admin.php
- phpcms2008 代码简介:数据库字典
- phpcms2008 代码简介:include/db_mysql.class.php
- 简化php模板页面中分页代码的解析
- 织梦CMS自定义PHP页面带参数解析模板代码
- 【Android应用开发】 Universal Image Loader ( 使用简介 | 示例代码解析 )
- Discuz X2.5、X2模板代码解析header.htm(头部文件)
- 总结——背包问题解析及模板代码
- 线段树解析以及代码模板
- 【Android应用开发】 Universal Image Loader ( 使用简介 | 示例代码解析 )
- dedecms 模板中解析php代码
- Smarty模板Windows下写代码 放到CentOS6.5无法正确解析
- phpcms2008 代码简介:include/common.inc.php
- 告别Dagger2模板代码:DaggerAndroid原理解析
- PHPCMS2008模板教程 默认模板解析及模板制作教程