Инструменты пользователя

Инструменты сайта


wiki:template:main.php

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
wiki:template:main.php [2024/01/29 12:53] – [At a minimum...] VladPolskiywiki:template:main.php [Дата неизвестна] (текущий) – удалено - внешнее изменение (Дата неизвестна) 127.0.0.1
Строка 1: Строка 1:
-====== файл шаблона main.php ====== 
  
-''main.php'' включает в себя большинство страниц, которые вы увидите при просмотре установки «ДокуВики»; сюда входят все «действия DokuWiki», перечисленные в менеджере конфигурации. 
- 
-Многие из описанных здесь функций также применимы для ''[[devel:templates:detail.php]]'' и ''[[devel:templates:mediamanager.php]]'', т.е. все, что находится до первого ''div'' плюс ''html_msgarea()'' должно быть общим для всех файлов шаблонов. 
- 
-===== Минимум... ===== 
- 
-Здесь представлены минимальные требования для правильного отображения и взаимодействия страницы с вашим шаблоном. 
- 
-==== Functionality ==== 
- 
-It's generally a good idea to start your template pages off with doctype and an %%<html>%% tag that tells the browser what language and text direction the wiki pages uses. 
-<code php> 
-<!DOCTYPE html> 
-<html 
-  xmlns="http://www.w3.org/1999/xhtml" 
-  xml:lang="<?php echo $conf['lang']?>" 
-  lang="<?php echo $conf['lang']?>" 
-  dir="<?php echo $lang['direction']?>"> 
-</code> 
- 
-The first actual php call is to ''[[xref>tpl_metaheaders()]]'', which encompasses CSS and JavaScript **required** and provided by DokuWiki, as well as anything gathered from ''style.ini''. 
- 
-<code php> 
-  <head> 
-    <?php tpl_metaheaders()?> 
-</code> 
- 
-Next is ''[[xref>tpl_pagetitle()]]'', which uses the page id (or optionally the first heading) to use as the page title alongside the title of your wiki((This is the reason for ''$conf'' in this case.)). It makes sense to declare the character set just before that: 
- 
-<code php> 
-    <meta charset="UTF-8" /> 
-    <title><?php tpl_pagetitle()?> - <?php echo hsc($conf['title'])?></title> 
-</code> 
- 
-To add a favicon you can use ''[[xref>tpl_favicon()]]'' which by default will use the ''favicon.ico'' in the template's ''images'' directory. But this can be overwritten by uploading that file to your wiki's ''wiki'' or root namespace via the media manager. 
- 
-<code php> 
-    <?php echo tpl_favicon(array('favicon')) ?> 
-  </head> 
-</code> 
- 
-Once you're ready to display, you'll need to add the ''[[xref>tpl_classes()]]'' (which also includes the ''dokuwiki'' class) somewhere at the top so that your page works correctly with plugins that use stylesheets. The ''%%dokuwiki__top%%'' ID is needed for the "Back to top" utility. 
-<code php> 
-  <body> 
-    <div class="<?php echo tpl_classes() ?>" id="dokuwiki__top"> 
-</code> 
- 
-Your template should have some consistent header, displaying the wiki's title and tagline: 
- 
-<code php> 
-      <h1><?php tpl_link(wl(),$conf['title'],'accesskey="h" title="[H]"') ?></h1> 
-      <?php if ($conf['tagline']): ?> 
-        <p><?php echo $conf['tagline'] ?></p> 
-      <?php endif ?> 
-</code> 
- 
-You'll need all of the utility buttons/links with [[xref>tpl_action()]] to really make your wiki functional. Here are all of the buttons provided by the default template. 
-<code php> 
-      <div class="actions"> 
-        <?php tpl_searchform()?> 
-        <?php tpl_action('admin')?> 
-        <?php tpl_action('profile')?> 
-        <?php tpl_action('register')?> 
-        <?php tpl_action('login')?> 
-        <?php tpl_action('edit')?> 
-        <?php tpl_action('revisions')?> 
-        <?php tpl_action('backlink')?> 
-        <?php tpl_action('subscribe')?> 
-        <?php tpl_action('revert')?> 
-        <?php tpl_action('recent')?> 
-        <?php tpl_action('media')?> 
-        <?php tpl_action('index')?> 
-        <?php tpl_action('top')?> 
-      </div> 
-</code> 
- 
-Now consider yourself in the content area of your page. First you will need a call to the error display function, ''[[xref>html_msgarea()]]''. This is what allows you to see e.g. configuration errors in DokuWiki whenever you have one, or plugin rendering errors, or lets you see the results of ''do=check'' whenever you add that to the end of a URL on your site. 
-<code php> 
-      <?php html_msgarea()?> 
-</code> 
- 
-Some odds and ends are "bread crumbs" and "you are here" links. You can add them anywhere in the content area, in any order with ''[[xref>tpl_breadcrumbs()]]'' and ''[[xref>tpl_youarehere()]]'', and they are totally optional and up to your discretion. If you're developing a template for general use, you'll want to support both so your end users can choose. 
- 
-<code php> 
-      <?php if ($conf['breadcrumbs']): ?> 
-        <p><?php tpl_breadcrumbs() ?></p> 
-      <?php endif ?> 
-      <?php if ($conf['youarehere']): ?> 
-        <p><?php tpl_youarehere() ?></p> 
-      <?php endif ?> 
-</code> 
- 
-The climax of the whole process is displaying the content of the page; it's just one call ''[[xref>tpl_content()]]'', and it's used for all actions --- viewing, editing, index navigation, searching, and any page with a form. 
-<code php> 
-      <?php tpl_content(); ?> 
-</code> 
- 
-Nearing the end of the content section, you can add information about when the page was last modified and who did it and as whom you are currently logged in and what the license of the wiki is: 
-<code php> 
-      <p> 
-        <?php tpl_pageinfo()?><br /> 
-        <?php tpl_userinfo()?><br /> 
-        <?php tpl_license()?> 
-      </p> 
-</code> 
- 
-Many templates display a [[faq:sidebar]] when the [[config:sidebar|sidebar config option]] is set. This will display the content of a page called "sidebar": 
- 
-<code php> 
-      <?php tpl_include_page($conf['sidebar'], 1, 1) ?> 
-</code> 
- 
-And finally, you **need** this function to ensure that the search is functioning properly and is finding your pages: 
-<code php> 
-      <?php tpl_indexerWebBug(); ?> 
-    </div> 
-  </body> 
-</html> 
-</code> 
- 
-=== Altogether now... === 
- 
-We have a small sample, workable ''main.php'' for a template, and it looks like this: 
-<code php> 
-<!DOCTYPE html> 
-<html 
-  xmlns="http://www.w3.org/1999/xhtml" 
-  xml:lang="<?php echo $conf['lang']?>" 
-  lang="<?php echo $conf['lang']?>" 
-  dir="<?php echo $lang['direction']?>"> 
-  <head> 
-    <?php tpl_metaheaders()?> 
-    <title><?php tpl_pagetitle()?> - <?php echo hsc($conf['title'])?></title> 
-    <?php echo tpl_favicon(array('favicon')) ?> 
-  </head> 
-  <body> 
-    <div class="<?php echo tpl_classes(); ?>" id="dokuwiki__top"> 
-      <h1><?php tpl_link(wl(),$conf['title'],'accesskey="h" title="[H]"') ?></h1> 
-      <?php if ($conf['tagline']): ?> 
-        <p><?php echo $conf['tagline'] ?></p> 
-      <?php endif ?> 
-      <div class="actions"> 
-        <?php tpl_searchform()?> 
-        <?php tpl_action('admin')?> 
-        <?php tpl_action('profile')?> 
-        <?php tpl_action('register')?> 
-        <?php tpl_action('login')?> 
-        <?php tpl_action('edit')?> 
-        <?php tpl_action('revisions')?> 
-        <?php tpl_action('backlink')?> 
-        <?php tpl_action('subscribe')?> 
-        <?php tpl_action('revert')?> 
-        <?php tpl_action('recent')?> 
-        <?php tpl_action('media')?> 
-        <?php tpl_action('index')?> 
-        <?php tpl_action('top')?> 
-      </div> 
-      <?php html_msgarea()?> 
-      <?php if ($conf['breadcrumbs']): ?> 
-        <p><?php tpl_breadcrumbs() ?></p> 
-      <?php endif ?> 
-      <?php if ($conf['youarehere']): ?> 
-        <p><?php tpl_youarehere() ?></p> 
-      <?php endif ?> 
-      <?php tpl_content(); ?> 
-      <p> 
-        <?php tpl_pageinfo()?><br /> 
-        <?php tpl_userinfo()?><br /> 
-        <?php tpl_license()?> 
-      </p> 
-      <?php tpl_include_page($conf['sidebar'], 1, 1) ?> 
-      <?php tpl_indexerWebBug(); ?> 
-    </div> 
-  </body> 
-</html> 
-</code> 
- 
-You now have all of the buttons, as well as the search field, and this is about everything you need to develop a template. 
- 
-==== Look and Feel ==== 
- 
-FIXME 
-An explanation of styles for: 
-  * Normal Viewing 
-  * Editing 
-  * Index Navigation (Or what might typically be called "site map" navigation) 
-  * Searching 
-  * Form type pages such as registration, profile, administration, configuration, etc. 
- 
-Should go here, as they all require stylesheet information. 
- 
- 
- 
- 
-===== Source ===== 
- 
-The source of the ''main.php'' of the 'dokuwiki' template can be found at [[xref>lib/tpl/dokuwiki/main.php]]. The [[https://github.com/selfthinker/dokuwiki_template_starter/blob/master/main.php|main.php of the Starter template]] contains even some helpful comments. 
- 
-=====See also===== 
-  * [[devel:templates|DokuWiki Template Development]] 
-  * [[mediamanager.php]] – the media-selection popup template file 
-  * [[detail.php]] – the image detail page template file 
wiki/template/main.php.1706521982.txt.gz · Последнее изменение: — VladPolskiy

Если не указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki