regex template plugin

regex_template plugin by Cédric Villemain
Choose template from regex on $ID

Last updated on 2009-10-14. Provides Action.
Compatible with DokuWiki 2009-02-14b.

Tagged with editing, template.

    This plugin works similar to namespace templates but the template to use is chosen based on a configuration matching regular expressions against the page name.

    Download and Installation

    Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.

    Adjust setting

    There is one configuration option to add regex, they must be added one per line, take care of spaces, in the following format:

     pattern,replacement

    pattern and replacement MUST follow the preg_replace rules.

    Example

     /.*:info:start/,templates:info_start
     /.*:info:.*:issue/,templates:info_issue

    You here just have to edit the templates/info_start and templates/info_issue to make them templates (no worry of _template.txt and __template.txt they are used if the regex does not match or if the templates in the regex does not exists.

    Discussion

    NS replace does not work, $id needs to be replaced by $ID (line 65 in action.php)

    	// replace placeholders
    	$tpl = str_replace('@ID@',$ID,$tpl);
    	$tpl = str_replace('@NS@',getNS($ID),$tpl);

    Otherwise great plugin. Jörg

     
    plugin/regex_template.txt · Last modified: 2009/11/09 16:46 by 212.204.78.42
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate