Customizing Admin templates

From time to time you need to change an admin form. Possibly remove some of the optional fields so that end users don't get confused. And because CMSMS is an open source package, and is written in PHP you can go head, find the right file(s) and tweak them to you're hearts content.

However, this has challenges. The next time that a new version of that particular module is released you'll have to re-do all of these changes because the upgrade will replace your modified files.

Fortunately, for minor things like tweaking admin templates CMSMS handles this nicely.

Lets say you're using the CompanyDirectory module as more like a member, and you want to remove a few fields that you won't need (like Fax), etc.

Lets say you want to remove the Fax field from the CompanyDirectory add/edit company forms. This is simple enough to do:

  • Create a new directory entitled templates underneath module_custom/CompanyDirectory.
  • Find the appropriate .tpl file in modules/CompanyDirectory/templates
  • Copy that template to module_custom/CompanyDirectory/templates
  • Edit the new file to remove the fax field.
    You will notice in the editcompany.tpl file some text that looks like below. Simply remove this text.
<div class="pageoverflow">
<p class="pagetext">{$faxtext}</p>
<p class="pageinput">{$inputfax}</p>

Now when you add a new company in the CompanyDirectory module the fax field will no longer be present.

These simple steps can be used over and over again, just edit more things in the template, to customize the appearance of any module. And when you upgrade to a newer version of the module, your changes will be intact.