Customize mwCMS
Aus mwcms.net
To customize mwCMS you can change the parser, create your own extensions (MediaWiki) or plugins (mwCMS).
Change the parser
This might be very simple or very difficult. To modify it you need to edit "include/class_parser.php".
Perhaps you want to modify your "Table of contents" on every page. Search in "include/class_parser.php" a method called "ParsingEveryLine". Add the following source code:
if (preg_match('!<div id="toctitle"><h2>Table of contents</h2></div>!', $oneLine)) { $modifiedLine = str_replace( '<div id="toctitle"><h2>Table of contents</h2></div>', '<div id="toctitle"><h2>Contents</h2></div>', $modifiedLine ); }
You could add additional HTML as well. More complex changes, like JavaScript, AJAX and so on, could be made within the parser, but it is not advised. Creating a large amount of (X)HTML within PHP, might become unmanagable (see Refactoring) in the future. That's why mwCMS is using a template engine called vlibTemplate. But you can use Smarty or whatever you like for your extensions or plugins (see below).
Important note: Please do not change the parser for new features like an interface between your MediaWiki and phpBB or your website and SAP. For new features extensions and plugins can be used.
Extensions (MediaWiki)
Extensions for MediaWiki are often used, not only with mwCMS. Creating extensions is easy.
$wgExtensionFunctions[] = 'example'; function example() { global $wgParser; $wgParser->setHook('example', 'process_input'); } function process_input($input, $args, $parser) { return 'Hello World! Your input: ' . htmlspecialchars($input); }
Here are some examples, which might be useful:
See a list of all extensions, because all can be used with mwCMS.
Plugins (mwCMS)
Plugins for mwCMS are often used, when MediaWiki is not enough or you need a complete different look. Programming a plugin is even more easy than to program an extension.
If you are using YAML, a plugin could look like this:
<?php include_once 'templates/col3_begin.htm'; ?> <h1>Hello World!</h1> <p>Date: <?=date('Y-m-d')?><p> <?php include_once 'templates/col3_end.htm'; ?>
If you are not using YAML you probably won't need "col3" at all. You can use
- HTML
- PHP
- JavaScript
- AJAX
- whatever you can think of
in your plugin. The sky is the limit!
