You are here: start » customization

Customization

Sometimes there's the need to customize CMSimple_XH. Basically it's fine to do the required modifications directly in the program files where appropriate. But with regard to future updates, it's better to touch the program files only as much as absolutely necessary. Ideally you should try to implement any modification as a plugin, or, if you don't need the full power of a plugin as some functionality in userfuncs.php.

userfuncs.php

The file cmsimple/userfuncs.php is guaranteed to never be distributed with CMSimple_XH, so it won't be overwritten with the next update. But it is automatically included from CMSimple_XH before the plugins. So you can use this file to add required functionality to CMSimple_XH.

The first line of userfuncs.php should always be:
<?php

If you have to modify a function of CMSimple_XH, you can copy the function over to userfuncs.php, delete it in the original place, and make your modifications in the copy in userfuncs.php. After an update, it often will suffice, to remove the function from its original place again.

If you need to modify some code in the global scope (i.e. outside a function), you often can't simply move this code to userfuncs.php, as the order of execution matters. In this case, it's best to keep the changes in the core files to the minimum, and if possible, to write a new function in userfuncs.php and to call it from the place where the modification is needed.

Bookkeeping

That's the most important part of any modification you're doing: note all you're changes in detail. A simple method is to comment all changes in the program files of CMSimple_XH. To easily find them later, you might write the comments like so:

// CUSTOMIZATION: ...

or for a block of code:

// CUSTOMIZATION-BEGIN: ...
...
// CUSTOMIZATION-END

Q: Does anybody know if and how such customizations can be tracked with a separate SVN repository?

Generally useful modifications

If you think the modification is useful for others too, please present it in the Open Development Forum (or in one of the non English forums). If others share your opinion about the general usefulness, it's quite likely that the modification will be part of the next version of CMSimple_XH – so you don't have to track your changes.

 
You are here: start » customization
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki