Modification System

Commentics provides a modification system to avoid editing core files. This helps preserve your changes when upgrading and makes it easy to install modules. To use the modification system you just create an XML file describing which file you want to edit and the code you want to add/replace. After uploading the XML file to the /system/modification/xml/ folder, Commentics will virtually modify the core file without actually doing so. The virtually modified file will be saved to /system/modification/cache/.

Let's dive straight into an example:

<?xml version="1.0" encoding="utf-8"?>
  <name>Comment Count</name>
  <file path="frontend/controller/main/comments.php">
      $this->data['lang_heading_comments'] .= ' (' . $this->data['total'] . ')';
      <add position="replace"><![CDATA[
      $this->data['lang_heading_comments'] .= ' [' . $this->data['total'] . ']';

In the above example, we're changing the comments heading, e.g. "Comments (27)". More specifically, we're changing the curly brackets to square brackets, resulting in "Comments [27]"

The 'name, 'version, 'author' and 'link' tags are only informational so put what you like there.

Let's look at the other tags.


The location of the file you want to modify. Using "backend/" will work even if you've renamed your backend folder.


You can have many operation tags within the file tag.


The piece of code that you want to modify. It's best to search for the smallest amount of code possible as this gives the highest chance that it will stay unchanged when upgrading.


The piece of code you want to add. Use the 'position' attribute to determine where the piece of code is added. Possible values are 'before', 'after' and 'replace'. You can also add an attribute called 'offset'. For example if you want to add the piece of code 2 lines after the search, use position="after" offset="2".

Other Notes

The filename of the XML file can be anything. However it's wise to give it a descriptive filename so you'll know what it's meant for without having to open it.

If the searched code is changed in an upgrade, meaning the XML file can no longer find it, the worst that will happen is the modification will be aborted and the original, core code will be used. Also a log file will be created in /system/logs/ explaining what happened.