plugin:tplinc
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
plugin:tplinc [2018-04-24 15:15] – created grosse | plugin:tplinc [2024-01-08 15:54] (current) – Aleksandr | ||
---|---|---|---|
Line 5: | Line 5: | ||
author | author | ||
email : dokuwiki@cosmocode.de | email : dokuwiki@cosmocode.de | ||
- | type : | + | type : |
- | lastupdate : 2017-03-28 | + | lastupdate : 2023-01-03 |
compatible : Greebo | compatible : Greebo | ||
depends | depends | ||
Line 18: | Line 18: | ||
donationurl: | donationurl: | ||
- | screenshot_img : | + | screenshot_img : plugin: |
---- | ---- | ||
- | [[http:// | + | [[https:// |
+ | |||
+ | This plugin allows template authors to define areas in the template where additional content can be included. Users of that template can then use this plugin to define which logic should be used to determine the content (pages) that should be included depending on the current page. | ||
+ | |||
+ | This is similar to how the sidebar works in the default template, only much more flexible. It is also possible to include multiple pages in the same area (one after another). | ||
===== Installation ===== | ===== Installation ===== | ||
- | Install | + | Search and install |
:!: The plugin needs a suitable template to provide hooks to which it can include the pages! So far, the following templates include such hooks: | :!: The plugin needs a suitable template to provide hooks to which it can include the pages! So far, the following templates include such hooks: | ||
+ | |||
* [[template: | * [[template: | ||
+ | |||
+ | You can use this plugin with templates that use traditional include hooks, by calling the plugin from within those hook files. For the [[template: | ||
+ | |||
+ | cp lib/ | ||
===== Configuration and Settings ===== | ===== Configuration and Settings ===== | ||
- | To configure | + | To configure, select " |
+ | |||
+ | * **Pattern** -- this is a pattern that is matched against the currently shown page, when it matches, the rule is applied | ||
+ | * **Page** -- this is the page to include when the pattern matches | ||
+ | * **Location** -- this is where the page will be shown in the template, the available areas are set by the used template | ||
+ | * **Skip ACL** -- unless this box is ticked, only page the current user may read are included | ||
+ | |||
+ | As pattern you can use the following: | ||
+ | |||
+ | * For a single page just specify its full page id | ||
+ | * For namespaces excluding subnamespaces use '' | ||
+ | * For namespaces including subnamespaces use '' | ||
+ | * Regular Expressions can be used starting and ending with ''/'' | ||
+ | |||
+ | Pages can optionally be given as relative IDs and will be resolved against the current page's namespace. When matching regular expressions, | ||
+ | |||
+ | Rules can be reordered by drag' | ||
===== Development ===== | ===== Development ===== | ||
+ | If you're a template author and want to integrate this plugin in your template, here is how you do it: | ||
+ | |||
+ | ==== Announcing available Include Locations ==== | ||
+ | |||
+ | You need to announce which locations are available in your template by registering a '' | ||
+ | |||
+ | Please refer to [[devel: | ||
+ | |||
+ | Here's an example handler: | ||
+ | |||
+ | <code php lib/ | ||
+ | <?php | ||
+ | namespace dokuwiki\template\example; | ||
+ | |||
+ | class TplIncludeHandler { | ||
+ | public function __construct() { | ||
+ | /** @var \Doku_Event_Handler */ | ||
+ | global $EVENT_HANDLER; | ||
+ | $EVENT_HANDLER-> | ||
+ | } | ||
+ | | ||
+ | public function registerIncludes(\Doku_Event $event) { | ||
+ | $event-> | ||
+ | $event-> | ||
+ | $event-> | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | You'd call this handler at the beginning of your '' | ||
+ | |||
+ | <code php lib/ | ||
+ | <?php | ||
+ | new dokuwiki\template\example\TplIncludeHandler(); | ||
+ | |||
+ | ... main code follows | ||
+ | </ | ||
+ | |||
+ | Be sure the PHP namespaces match your template name. | ||
+ | |||
+ | ==== Using Includes ==== | ||
+ | |||
+ | At the places where you want to allow users to include pages, use the following code: | ||
+ | |||
+ | <code php> | ||
+ | $tplinc = plugin_load(' | ||
+ | if($tplinc) echo $tplinc-> | ||
+ | </ | ||
+ | |||
+ | The '' | ||
==== Commit-Ticker ==== | ==== Commit-Ticker ==== | ||
Line 43: | Line 118: | ||
**Releases: | **Releases: | ||
{{rss> | {{rss> | ||
- | |||
- | |||
plugin/tplinc.1524575737.txt.gz · Last modified: 2018-04-24 15:15 by grosse