【php精品源码栏目提醒】:网学会员为广大网友收集整理了,程序模板说明 - 其它资料,希望对大家有所帮助!
分享模板说明core/service 目录:服务文件文件命名格式:类名 .service.php 如 userinfo. service.php(类名小写)类命名格式:类名 Service 如 UserInfoService(类名英文首字母大写)引用方式 service FS‘UserInfo’core/ module 目录:页面显示操作文件文件命名格式:类名 . module.php 如 userinfo. module.php(类名小写)类命名格式:类名 Service 如 UserInfoModule(类名英文首字母大写)引用方式 FM‘UserInfo’- reg 或 require fimportmodule/userinfo UserInfoModule::regcore/class 目录:类文件文件命名格式:类名 . class.php 如 userinfo. class.php(类名小写)类命名格式:类名英文首字母大写 如 UserInfo引用方式 require fimport‘class/userinfo class new UserInfocore/ include 目录:引用执行文件文件命名格式:类名 .inc.php 如 userinfo. inc.php(类名小写)引用方式 require fimport‘include/userinfo core/ cache 目录:缓存方法执行文件文件命名格式:名称 . cache.php 如 setting.cache.php(名称小写)执行函数命名:bindCache 名称 如 bindCacheSetting (名称英文首字母大写)加载缓存方式: //页面初始化时加载 require dirname__FILE__./core/service/fanwe.service.php fanwe FanweService::instance fanwe-cache_list setting fanwe-initialize //程序中加载 FanweService::instance-cache-loadCachesetting 调用缓存方式:global _FANWE _FANWE‘cache’‘setting’core/ dynamic 目录:页面动态执行文件文件命名格式:名称 .dynamic.php 如 index.dynamic.php(名称小写)程序会根据 MODULE_NAME 进行引用core/ language 目录:语言包文件命名格式:名称 .lang.php 如 index.lang.php(名称小写)其中的 template.lang.php 为模板中调用的语言包,如果设置模板 tpl模板名template.lang.php ,将覆盖自动 core/ language 下的语言包设置程序调用方式:test lang‘文件名’’键名’ 例 test lang‘index’’home’函数格式:function funHandle …….变量格式:var_id ‘abc’ (命名以_分隔)分页程序: pager buildPage模块/操作查询参数数组总数当前页分页大小 例 链接 book.phpactionindexcid10sorthot page_args array page_args‘cid’ ‘10’ page_args‘sort’ ‘hot’ pager buildPagebook/indexpage_args100_FANWEpage10模板corefunctionglobal.func.php 为公共函数文件corefunctiontime.func.php 为时间函数文件全局变量说明:FANWE_ROOT 站点根目录路径PUBLIC_ROOT 站点 public 目录路径TPL_PATH 站点 当前模板 路径TMPL 站点 当前模板SITE_URL 当前网站相对路径 如果在根目录刚为 / 二级目录则为 /abc-------------------------------------------------------------模板中可直接使用 _FANWE 变量,方法中 先使用 global _FANWE引用_FANWEuid 当前会员编号,未登陆为 0_FANWEuser_name 当前会员名称,未登陆为空_FANWEgid 当前会员组,未登陆为游客 6_FANWEclient_ip 客户端 IP_FANWEsite_url 当前网站地址如 http://www.baidu.com/_FANWEsite_root 当前网站相对路径 如果在根目录刚为 / 二级目录则为 /abc_FANWEconfig 当前站点配置文件 public/config.global.php 中的设置_FANWEsetting 当前站点配置 数据表 sys_conf 中的相关设置 键名为小写 例: _FANWEsetting site_name_FANWEuser 当前登陆会员的信息_FANWEcookie cookie 信息_FANWEcache 缓存信息AJAX 服务处理//统一放到 services/module 下格式为 services/module/模块/操作.php例 servicesmoduleuserlogin.phpAjax 调用地址 SITE_PATH services/service.phpmuseralogin模板标签说明: 标签 例子 说明 if a b if 判断elseif a belse/ifloop list item loop users user foreach 循环/loop 用户名:username /looploop list key item loop users user_index user foreach 循环,带键名/loop 会员user_index :username /loop template 模板路径 template inc/header 引用模板,单独生成引用模板的结构缓 存文件 subtemplate 模板路径 subtemplate inc/header 引用模板,与当前页面一起生成缓存文 件。上一篇:山东大学教师单位公派出国留学程序【精品文档】