Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/www/domains/hppgallery_com/design/defaulttheme/tpl/pagelayouts/main.php on line 59

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/www/domains/hppgallery_com/design/defaulttheme/tpl/pagelayouts/main.php on line 59
Monday, August 21, 2017
 

Explains how module override system works. Also how to write extensions

This tutorial explains how to write custom extension and also override default module files.

 

All extensions must by located in extension folder. For dummy example I will explain how to overridehttp://testsgallery.din.lt/index.php?/user/forgotpassword functionality.

Requirements:

Please make sure that these settings are false

'templatecache' => false,
'templatecompile' => false,      
'modulecompile' => false,

Creating directory structure

First we create folder dummyextension in extension directory.

Directory structure looks like:

extension
    dummyextension

Next we have to create directory modules in directory dummyextension. So far all looks like:

extension
    dummyextension
        modules

Next because we are overriding user module. We must create directory named lhuser. Then directory structure looks like:

extension
    dummyextension
        modules
            lhuser

Next we have to create two files. One for module itself and one for login function.

extension
    dummyextension
        modules
            lhuser
                module.php
                forgotpassword.php

module.php file content:

<?php

$Module = array( "name" => "User module forgot password override",
                                 'variable_params' => true );

$ViewList = array();
   
$ViewList['forgotpassword'] = array( 
    'params' => array(),
    'functions' => array( 'customfunction' ),
); 
    
$FunctionList = array();  
$FunctionList['customfunction'] = array('explain' => 'Custom function [customfunction]');

?>

In module file we can also introduce custom functions.

forgotpassword.php file content:

<?php
$Result['content'] = 'Forgot password override';
?>

Then we are done we have to edit settings.php file to let system now that we have new module:

'extensions' => array(
            'dummyextension'
      ),

That's it. That way we can override custom gallery functions or write our own modules.

Back »

Comments: 0

Leave a reply »

 
  • Leave a Reply
    Your gravatar
    Your Name
     
     
     
     
 
About HPPG

High performance photo gallery dedicated for large numbers of image storage.

Get in touch

Donate



Download