模板制作教程:模板文件
网站表单/全局表单模板
前端界面
默认网站表单模板介绍
发布:/template/pc/default/home/form/form_post.html 列表:/template/pc/default/home/form/form_list.html 查看:/template/pc/default/home/form/form_show.html
自定义网站表单模板介绍
发布:/template/pc/default/home/form/表单表名_post.html 列表:/template/pc/default/home/form/表单表名_list.html 查看:/template/pc/default/home/form/表单表名_show.html
网站表单URL地址介绍
发布:{router::form_post_url("表单英文名")} 列表:{router::form_list_url("表单英文名")} 查看:{router::form_show_url("表单英文名", 表单id)}
网站表单列表页面标签
{$form_name} 表单中文名称 {$form_table} 表单英文名称 // 表单数据列表分页模式调用方法 {form form=$form_table page=1 urlrule=$urlrule pagesize=5} {router::form_show_url($form_table, $t.id)} 表单内容地址 {dr_strcut($t.title, 60)} 截取60个字符的标题 {$t.inputtime} 格式化后的发布日期 {dr_date($t._inputtime, "Y-m-d")} 自定义发布日期 {/form} {$pages} 分页字符串
表单内容页标签
{$form_name} 表单中文名称 {$form_table} 表单英文名称 {$title} 标题 {$inputtime} 发布时间 {$自定义字段} 自定义字段输出(每个自定义的字段输出方式不一样,具体参考字段输出说明)
会员界面
默认网站表单模板介绍
发布:/template/pc/default/member/form/form_post.html 列表:/template/pc/default/member/form/form_list.html
自定义网站表单模板介绍
发布:/template/pc/default/member/form/表单表名_post.html 列表:/template/pc/default/member/form/表单表名_list.html
后台界面
默认网站表单模板介绍
发布:/dayrui/App/Form/Views/share_form_post.html 列表:/dayrui/App/Form/Views/share_form_list.html
自定义网站表单模板介绍
发布:/dayrui/App/Form/Views/表单表名_post.html 列表:/dayrui/App/Form/Views/表单表名_list.html
模块表单模板
前端界面
默认模块表单模板介绍
发布:/template/pc/default/home/mform_post.html 列表:/template/pc/default/home/mform_list.html 查看:/template/pc/default/home/mform_show.html
自定义模块表单模板介绍
发布:/template/pc/default/home/模块目录/表单表名_post.html 列表:/template/pc/default/home/模块目录/表单表名_list.html 查看:/template/pc/default/home/模块目录/表单表名_show.html
模块表单URL地址介绍
发布:{router::mform_post_url("表单英文名", "内容id", "模块目录")} 列表:{router::mform_list_url("表单英文名", "内容id", "模块目录")} 查看:{router::mform_show_url("表单英文名", "表单id", "模块目录")}
会员界面
默认模块表单模板介绍
发布:/template/pc/default/member/mform_post.html 列表:/template/pc/default/member/mform_list.html
自定义模块表单模板介绍
发布:/template/pc/default/member/模块目录/表单表名_post.html 列表:/template/pc/default/member/模块目录/表单表名_list.html
后台界面
默认网站表单模板介绍
发布:/dayrui/App/Mform/Views/share_mform_post.html 列表:/dayrui/App/Mform/Views/share_mform_list.html
自定义网站表单模板介绍
发布:/dayrui/App/模块目录/Views/表单表名_post.html 列表:/dayrui/App/模块目录/Views/表单表名_list.html
模块相关文件
按照demo模块为例子
前端界面
1、前端显示模板介绍
模块首页:/template/pc/default/home/demo/index.html (独立模块才有) 模块栏目封面:/template/pc/default/home/demo/category.html 模块栏目列表:/template/pc/default/home/demo/list.html 模块内容:/template/pc/default/home/demo/show.html 模块搜索页面:/template/pc/default/home/demo/search.html 模块评论页面:/template/pc/default/home/demo/comment.html comment_ajax.html
2、用户中心管理模板介绍
发布:/template/pc/default/member/demo/module_post.html 内容列表:/template/pc/default/member/demo/module_list.html 草稿列表:/template/pc/default/member/demo/module_draft.html 审核列表:/template/pc/default/member/demo/module_verify.html
如果上面地址不存在,cms默认会使用上一层目录中的文件
后台界面
默认模块模板介绍
发布:/dayrui/App/Module/Views/share_post.html 列表:/dayrui/App/Module/Views/share_list.html
自定义模板介绍
发布:/dayrui/App/Demo/Views/demo_post.html 列表:/dayrui/App/Demo/Views/demo_list.html
模块草稿、回收站、审核、定时的内容预览页
模块内容的草稿、回收站、审核、定时的内容预览页,建议只做内容展示预览功能,不要加一些逻辑判断,比如相关标签代码啊、评论框代码啊、阅读数统计代码啊,这些页面是临时的内容展示界面,不会具备逻辑操作功能
临时模板命名格式如下:
草稿 /template/pc/home/模块目录/show_draft.html 回收站 /template/pc/home/模块目录/show_recycle.html 审核 /template/pc/home/模块目录/show_verify.html 定时 /template/pc/home/模块目录/show_time.html
当不存在这些目标时(默认模板就没有做这些页面),系统会调用同级别的show.html作为显示模板
模板标签和show.html标签类似,仅用于调用当前内容的数据!
自定义模块后台模板文件
模块自定义后,可以为他单独设计,管理页面和发布页面
一、如何自己修改后台模块的模板又不影响系统升级呢?
默认模块模板介绍
发布/修改:/dayrui/App/Module/Views/share_post.html 列表:/dayrui/App/Module/Views/share_list.html
如果要改的话,不能改上面的文件,需要把它复制出来,再修改
比如demo模块为例,那么他的自定义文件就是:
发布/修改:/dayrui/App/Demo/Views/demo_post.html 列表:/dayrui/App/Demo/Views/demo_list.html
把上面默认模块模板的文件复制进去再重命名
注意:发布和修改页面共用的模板是:***_post.html,如果有这个必要,也可以进行区别发布和修改页面,
例如:demo_post.html改为demo_edit.html,那么此edit文件就是修改界面的单独模板了
二、模块后台模板介绍和对应复制目录介绍
模板名称 | 默认模板路径 | 复制后的模板路径 |
发布页面 | /dayrui/App/Module/Views/share_post.html | /dayrui/App/Demo/Views/demo_post.html |
已通过的列表页面 | /dayrui/App/Module/Views/share_list.html | /dayrui/App/Demo/Views/demo_list.html |
审核列表页面 | /dayrui/App/Module/Views/share_list_verify.html | /dayrui/App/Demo/Views/demo_list_verify.html |
栏目列表页面 | dayrui/Fcms/Module/Views/share_category_list.html | /dayrui/App/Demo/Views/demo_category_list.html |
栏目发布或修改页面 | dayrui/Fcms/Module/Views/share_category_post.html | /dayrui/App/Demo/Views/demo_category_post.html |
评论列表页面 | dayrui/Fcms/Comment/Views/share_comment_list.html | /dayrui/App/Demo/Views/demo_comment_list.html |
评论添加修改页面 | dayrui/Fcms/Comment/Views/share_comment_post.html | /dayrui/App/Demo/Views/demo_comment_post.html |
评论评分查看页面 | dayrui/Fcms/Comment/Views/share_comment_review.html | /dayrui/App/Demo/Views/demo_comment_review.html |
回收站管理页面 | dayrui/Fcms/Comment/Views/share_list_recycle.html | /dayrui/App/Demo/Views/demo_list_recycle.html |
列表页引用文件{template "mytable.html"}表示引用主框架的通用列表样式文件,位于:dayrui/Fcms/View/mytable.html
自定义后台模板文件
当需要修改后台模板时可以采用此方法来修改,不影响对程序的升级
一、自定义后台模板文件
例如需要修改系统默认模板:
/dayrui/Fcms/View/api_my.html
此文件位于Core目录下,是不允许开发者修改的,如果非要修改,需要复制到自定义的位置:
/dayrui/My/View/api_my.html
View目录不存在就新建,不要加s
例如,自定义联动菜单页面的界面
1、开启开发者模式,进入联动菜单页面,可以看到他的模板路径
或者开启开发在模式在下面的小火苗,进入views选项
2、把图中的模板文件复制到
/dayrui/Fcms/View/linkage_index.html
复制到
/dayrui/My/View/linkage_index.html
改这个新模板,就不会影响程序的升级
应用插件自带的后台模板修改方法与之类似,
/dayrui/My/View/插件目录(字母小写)/模板名称.html
例如/dayrui/App/Member/Views/member_list.html,那么他的自定义路径为:
/dayrui/My/View/member/member_list.html
二、自定义后台css样式文件
/static/assets/global/css/my.css
此文件的样式可以随意调整,适用于改变后台布局、后台配色、后台增加样式等等,不会影响升级的
按模块内容单独自定义模板
宸逸cms默认情况下,模块内容页面的模板是show.html,可以通过栏目属性中修改本栏目下的内容统一一个模板文件,例如改成show2.html作为本栏目的内容模板。
那么,在实际环境中需要为单独的内容页面设定不同的内容模板怎么办?
1、进入某个模块的字段管理
2、创建一个字段,类型是text,名称随便填,字段名称必须是template
3、更新缓存生效
4、修改文章内容,就可以看到这个字段
----------
这里使用输入模板地址的方式储存,必须是.html结尾,不得带目录
5、访问这个内容时,就会调用/template/pc[可变动]/default[可变动]/home/news[模块目录]/aaa.html
当aaa.html不存在时,系统会引用默认模板show.html
系统信息提示页面msg.html
用来提示系统的信息,例如这种提示:
模板文件路径:
/template/pc/default/home/msg.html
提示信息输出格式:
{if $code} 提示成功的信息 {else} 提示失败的信息 {/if} {if $url} 如果您的浏览器没有自动跳转,请点击这里 {else} [点击返回上一页] {/if}
404错误页面文件
在服务器里面关闭404页面设置,例如宝塔设置方法如下:
用来提示页面不存在,内容不存在时的404界面例如下方样式:
此页面的http状态码是:404
模板文件路径:
/template/pc/default(根据你的模板目录而变化)/home/404.html
提示信息输出格式:
栏目封面模板
栏目模板分为封面模板和列表模板
1、封面模板:category.html,此页面为父栏目属性时的模板,它可以显示多个子栏目聚合一个封面频道界面。
2、列表模板:list.html,是终极栏目的列表页,支持分页显示文章列表。
如何将封面栏目的模板设置为列表栏目?
1、进入封面栏目的编辑页面,找到模板设置
2、将category.html改成list.html,意思是列表模板和封面模板相同就行。
注意:当生成静态时,封面栏目之后生成第一页。
如何将封面栏目支持发布内容功能和生成静态分页功能呢?
外链下载提示页面down_file_msg.html
模板文件路径:
/template/pc/default/home/api/down_file_msg.html
用于外链文件,下载时的提示界面,如果没有这个模板就用msg.html代替
提示信息输出格式:
下载附件如果不提示进入自动下载的写法是: