> > Topic

Overwriting pages with customized versions

Jan 3, 2007 / pixtur
Jan 5, 2009 / phsouzacruz
 

Attached files

No files uploaded
 
For the new project page at www.streber-pm.org pixtur uses a customized version of projView and some other pages. Overwriting pages is done by adding a block to your customize.inc.php file:

from customize.inc.php

function postInitCustomize() 
{
    global $PH;
    $PH->hash['projView']->req= 'pages/custom_projView.inc.php';
    $PH->hash['projViewFiles']->req= 'pages/custom_projViewFiles.inc.php';
}

Because the file needs to be included very early to define all following objects with correctly translated title, we define a new function postInitCustomize() which is been called by index.php after most initilization is done but before any user rights are checked. This function can be used to tune or bend global variables or fields.

When defined like above, postInitCustomize() directly accesses the hash in which the PageHandler defines all available pages. There it overwrites the require file to a new version: custom_projView.inc.php.

If you want to create custom pages I suggest to add this into new directory starting with a "_*" (e.g. "_custom_pages/"). This will prevent from accidental overwriting on version upgrades.



also read:

1 Comments

guest:error in above mentioned code

11 years ago -

Hi,

after adding the above lines to my customize.inc.php file I could not open the "files" section anymore. I just found out why and wanted to let you know.

The second line should actually be:
    $PH->hash['projViewFiles']->req = 'pages/custom_projViewFiles.inc.php';

Greets,