自定义主题¶
phpMyAdmin 带有对第三方主题的支持。你可以从我们的网站 <https://www.phpmyadmin.net/themes/> 下载额外的主题。
设置¶
Themes are configured with $cfg['ThemeManager']
and
$cfg['ThemeDefault']
. Under ./public/themes/
, you should not
delete the directory pmahomme
or its underlying structure, because this is
the system theme used by phpMyAdmin. pmahomme
contains all images and
styles, for backwards compatibility and for all themes that would not include
images or css-files. If $cfg['ThemeManager']
is enabled, you
can select your favorite theme on the main page. Your selected theme will be
stored in a cookie.
创建自定义主题¶
要创建一个主题,请按照下面的方法进行操作:
- make a new subdirectory (for example “your_theme_name”) under
./public/themes/
. - 将文件和目录从
pmahomme
复制到您的主题目录下 - 编辑 “your_theme_name/css” 文件夹中的 css 文件
- 将您的新图片放到 “your_theme_name/img” 文件夹中
- 编辑 “your_theme_name/scss” 目录下的
_variables.scss
文件 - 编辑您的主题目录下的`theme.json`来包含主题元数据(见下文)
- 为您的主题制作一张屏幕截图并保存到“your_theme_name/screen.png”
主题元数据¶
在 4.8.0 版更改: 在版本4.8.0之前,主题元数据是在 info.inc.php
文件中传递。它已被 theme.json
所取代,以便更容易解析(不需要处理PHP代码)并支持额外的功能。
在主题目录中有一个文件 theme.json
,它包含了主题元数据。目前它由以下内容组成:
-
name
主题的显示名称。
此字段为必填字段。
-
version
主题的版本,可以人工指定,无需与 phpMyAdmin 的版本匹配。
此字段为必填字段。
-
description
主题描述,会在网站上显示。
此字段为必填字段。
-
author
主题作者名称。
此字段为必填字段。
-
url
到主题作者的网站链接,可以获取支持。
-
supports
由所支持 phpMyAdmin 的主要版本组成的数组。
此字段为必填字段。
例如,phpMyAdmin 4.8 版本自带的原始主题定义如下:
{
"name": "Original",
"version": "4.8",
"description": "Original phpMyAdmin theme",
"author": "phpMyAdmin developers",
"url": "https://www.phpmyadmin.net/",
"supports": ["4.8"]
}
共享图片资源¶
如果您的主题不需要使用自己的图标和按钮,请删除您的主题目录“your_theme_name”下的“img”目录。phpMyAdmin 将使用默认的图标和按钮(位于 pmahomme
目录下的系统主题)。