1. ├ config ······································ 配置目录
  2. │ ├ function.php ························ 自定义方法
  3. │ └ theme.config.php ···················· 主题配置文件
  4. ├ includes ···································· 模板引用文件
  5. │ ├ common ································ 公共引用文件
  6. │ ├ cotnent ······························· 详情页引用文件
  7. │ ├ category ······························ 分类页引用文件
  8. │ ├ index ································· 首页引用文件
  9. │ ├ search ································ 搜索页引用文件
  10. │ └ page ··································· 自定义页引用文件
  11. ├ lang ········································ 语言包目录
  12. ├ layout ······································ 模板布局
  13. ├ sections ···································· 模板区块组件
  14. └ templates ··································· 模板文件
  15. ├ cotnent ······························ 详情页模板
  16. ├ category ····························· 分类模板
  17. ├ index ································ 首页模板
  18. ├ search ······························· 搜索模板
  19. └ page ································· 自定义页模板文件

config

该目录为配置文件目录,用于存放一些自定义的配置信息

function.php

function.php 是一个全局方法类,该文件类暴露的类名为 Func 你可以在该类里面编写自己的静态方法,然后通过 Func::方法名称() 在该主题全局范围内调用

theme.config.php

theme.config.php 定义主题的模板路径信息,定义导航栏配置等
默认配置代码:

  1. <?php
  2. /**
  3. * 主题配置信息
  4. * Created By DigoodCMS
  5. * Date: 2020/4/15
  6. */
  7. return [
  8. ## 主题信息
  9. 'theme' => [
  10. ## 作者
  11. 'author' => '作者',
  12. ## 版本号
  13. 'version' => 'v.1.0.0',
  14. ],
  15. /**
  16. * 模板文件
  17. * @params title 标题
  18. * @params model 所属内容模型
  19. * @params type 模板类型 category|content|page|index|search
  20. * @params file 模板路径(templates下的路径)
  21. */
  22. 'templates' => [
  23. ['title' => '首页', 'model' => 'index', 'type' => 'index', 'file' => 'index.default'],
  24. ['title' => '产品列表', 'model' => 'product', 'type' => 'category', 'file' => 'category.product'],
  25. ['title' => '产品详情', 'model' => 'product', 'type' => 'content', 'file' => 'content.product'],
  26. ['title' => '新闻列表', 'model' => 'article', 'type' => 'category', 'file' => 'category.article'],
  27. ['title' => '新闻详情', 'model' => 'article', 'type' => 'content', 'file' => 'content.article'],
  28. ['title' => 'About Us', 'model' => 'page', 'type' => 'page', 'file' => 'page.about'],
  29. ['title' => 'Contact Us', 'model' => 'page', 'type' => 'page', 'file' => 'page.contact'],
  30. ['title' => '默认自定义页面', 'model' => 'page', 'type' => 'page', 'file' => 'page.default'],
  31. ['title' => '默认搜索结果页', 'model' => 'product', 'type' => 'search', 'file' => 'search.default'],
  32. ],
  33. /**
  34. * 导航栏配置
  35. * @index 导航索引
  36. * @params label 导航标识
  37. * @params icon 图标
  38. */
  39. 'menu' => [
  40. 'main_menu' => ['label' => '主导航', 'icon' => 'mdi-segment'],
  41. 'sidebar' => ['label' => '侧边栏', 'icon' => 'mdi-segment'],
  42. 'footer_link' => ['label' => '底部链接', 'icon' => 'mdi-segment'],
  43. ]
  44. ];

includes

所有 templates 内模板文件需要 include 的块 都应该放在该目录,目录下根据模板 type 进行分类,目前所支持类型包含 category、content、page、index、search 以及一个 common 公共目录

common

存放需要公共引入的模块,例如:header、footer、breadcrumbs 等

cotnent

存放内容页面的模块,例如: product、news、article 等内容详情

category

存放分类列表页面的模块,例如: product、news、article 等分类列表

index

存放首页需要引入的模块

page

存放用于自定义页面引入的模块

lang

语言包内容文件,该文件夹无需操作,用于包会根据 在 include 文件内 注册的语言包字段自动生成

layout

布局文件用于模板文件继承使用,所有模板文件都需要继承一个布局,所以该文件夹中至少需要有一个布局文件存在,布局文件内包含 SEO信息输出,样式和脚本输出,全局部件等所有公共信息

sections

用于存放可以多次调用的通用组件块,例如 menu、漂浮框、遍历用到的列表组件等

templates

用于存放需要暴露使用的模板文件,该目录下已模板文件的 type 进行分类

cotnent

存放内容详情模板,例如: product、news、article 等

category

存放分类列表模板,例如: product、news、article 等

index

用于存放首页模板

page

用于存放自定义页面模板,例如:about、contact 等