实现DokuWiki模板涉及几个步骤,主要包括创建模板结构、编写必要的PHP和CSS文件,以及配置DokuWiki以使用新模板。以下是实现DokuWiki模板的主要步骤:
1. 创建模板结构
text
/lib/tpl/mytemplate/
├── main.php
├── style.ini
├── screen.css
└── template.info.txt
php
<?php
if(!defined('DOKU_INC')) die();
?>
<!DOCTYPE html>
<html lang="<?= $conf['lang'] ?>" dir="<?= $lang['direction'] ?>">
<head>
<meta charset="utf-8" />
<title><?= tpl_pagetitle() ?> [<?= strip_tags($conf['title']) ?>]</title>
<?= tpl_metaheaders() ?>
<?= tpl_favicon(array('favicon', 'mobile')) ?>
<?php tpl_includeFile('meta.html') ?>
</head>
<body>
<?php tpl_includeFile('header.html') ?>
<div class="dokuwiki">
<div class="header">
<h1><?= tpl_link(wl(),$conf['title'],'name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[H]"') ?></h1>
</div>
<div class="page">
<!-- wiki text will be inserted here -->
<?= tpl_content() ?>
</div>
</div>
<?php tpl_includeFile('footer.html') ?>
</body>
</html>
ini
[interwiki]
__base__ = ""
__site_width__ = "800px"
__sidebar_width__ = "200px"
ini
base = mytemplate
author = Your Name
email = [email protected]
date = 2023-01-01
name = My Template
desc = A description of your template
url = http://example.com