Customizing EMG Portal

EMG Portal is written in PHP and can thereby quite easily be modified by the customer.

In the standard distribution of EMG the model files (protected/models and protected/components) are encoded using ionCube PHP Encoder. However, view files and controllers are not encoded and can thereby be modified.

When updating EMG Portal you would normally extract the new version on top of the current version used and thereby any changes will be overwritten.

In order to make customization easier it is possible to make some changes without having modification overwritten when applying an upgrade.

Any new files added will not be overwritten, since they should not be included in the distribution (unless there is same naming collision).

You should always make a complete backup of the EMG Portal application (normally /var/www/html/emgportal) before applying any changes.

Custom layout template

In protected/views/layouts two sample template files are provided, main.php and wide.php.

The first step in customizing EMG Portal is to copy one of the provided layout files and modify the look and feel, for example changing the logotype and modify colors in css.

To use the new layout file you need to specify it in the config file, protected/config/main.php.

For example, if you base the custom layout on wide.php and name the new layout file mylayout.php you would change

'layout' => 'wide',

to

'layout' => 'mylayout'

in protected/config/main.php.

If you want to modify the css you should make a copy of the css file you want to modify and reference the copy from your layout file.

Custom views

The EMG Portal view resolver in version 2.7 and later will check for a view file in the view subdirectory “custom” when locating the view file to use.

For example, you can create your own custom top menu by copying protected/views/shared/_top_menu.php into protected/views/shared/custom/_top_menu.php and modifying that file.