Go to page content

Modifying an existing module

Safely overriding core modules to make them do what you need or want.


Sometimes a module presents things on screen in a way you don't like.  It might be that a certain piece is missing or the order of the elements breaks something you are trying to do.  This guide presents some techniques for working around this.


Readers are assumed to be comfortable editing templates and identifying the source of content by searching the Zotonic codebase.


Changing the Look and Feel

You should be able to get most of the way with CSS.

Failing that, you should try overriding templates:

  1. Copy the templates to your own site/module

  2. Make sure that the priority of your site is higher than the original module

    (check prio in the admin/modules, should be a lower number. Ie 1 has higher prio than 500)

Changing the Logic of a Module

In extreme cases, you can copy the module into the modules directory of your site and rename it.  Make sure to change the module attributes within the Erlang modules along with renaming the files themselves.

A case for this would be an outdated core module that no longer works with an API or protocol due to external changes.  For example, if Twitter dropped their current streaming interface (unlikely) then you might need to copy and modify mod_twitter in order to bridge the gap until you submit a patch and its gets accepted.


Did an update break your site? Check your template overrides

You can very easily get yourself in hot water with template modifications.  When I modified the menu templates to support third-level menus before Arjan implemented them in the core mod_menu I wound up with a site that wouldn't start after upgrading to 0.7.  Your first line of debugging after an update should be to move your overridden templates aside and see if your site works without them.

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.