├ config ······································ 配置目录
│ ├ function.php ························ 自定义方法
│ └ theme.config.php ···················· 主题配置文件
├ includes ···································· 模板引用文件
│ ├ common ································ 公共引用文件
│ ├ cotnent ······························· 详情页引用文件
│ ├ category ······························ 分类页引用文件
│ ├ index ································· 首页引用文件
│ ├ search ································ 搜索页引用文件
│ └ page ··································· 自定义页引用文件
├ lang ········································ 语言包目录
├ layout ······································ 模板布局
├ sections ···································· 模板区块组件
└ templates ··································· 模板文件
├ cotnent ······························ 详情页模板
├ category ····························· 分类模板
├ index ································ 首页模板
├ search ······························· 搜索模板
└ page ································· 自定义页模板文件
config
该目录为配置文件目录,用于存放一些自定义的配置信息
function.php
function.php 是一个全局方法类,该文件类暴露的类名为 Func 你可以在该类里面编写自己的静态方法,然后通过 Func::方法名称() 在该主题全局范围内调用
theme.config.php
theme.config.php 定义主题的模板路径信息,定义导航栏配置等
默认配置代码:
<?php
/**
* 主题配置信息
* Created By DigoodCMS
* Date: 2020/4/15
*/
return [
## 主题信息
'theme' => [
## 作者
'author' => '作者',
## 版本号
'version' => 'v.1.0.0',
],
/**
* 模板文件
* @params title 标题
* @params model 所属内容模型
* @params type 模板类型 category|content|page|index|search
* @params file 模板路径(templates下的路径)
*/
'templates' => [
['title' => '首页', 'model' => 'index', 'type' => 'index', 'file' => 'index.default'],
['title' => '产品列表', 'model' => 'product', 'type' => 'category', 'file' => 'category.product'],
['title' => '产品详情', 'model' => 'product', 'type' => 'content', 'file' => 'content.product'],
['title' => '新闻列表', 'model' => 'article', 'type' => 'category', 'file' => 'category.article'],
['title' => '新闻详情', 'model' => 'article', 'type' => 'content', 'file' => 'content.article'],
['title' => 'About Us', 'model' => 'page', 'type' => 'page', 'file' => 'page.about'],
['title' => 'Contact Us', 'model' => 'page', 'type' => 'page', 'file' => 'page.contact'],
['title' => '默认自定义页面', 'model' => 'page', 'type' => 'page', 'file' => 'page.default'],
['title' => '默认搜索结果页', 'model' => 'product', 'type' => 'search', 'file' => 'search.default'],
],
/**
* 导航栏配置
* @index 导航索引
* @params label 导航标识
* @params icon 图标
*/
'menu' => [
'main_menu' => ['label' => '主导航', 'icon' => 'mdi-segment'],
'sidebar' => ['label' => '侧边栏', 'icon' => 'mdi-segment'],
'footer_link' => ['label' => '底部链接', 'icon' => 'mdi-segment'],
]
];
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 等