1. Optimizing templates {Hack for Dle 9.x}

Optimizing templates {Hack for Dle 9.x}

  |   5
Optimizing templates {Hack for Dle 9.x}This hack allows you to optimize templates in Datalife Engine for further parsing.
As you know, Datalife Engine supports multiple templates and users can change the skins for your website if you set to allow. Change skins in the website using Datalife Engine can cause the server loading many times due to the DLE modules use different theme files to load the contents. This hack will cache the template and help reduce server loading on your website.

Examples of comparison
Before installation of the hack:
A third-party module shows a list of news, loading the same template 10 times. At this spent about 0.13 seconds.

After you install the hack:
At the same action will save at least 0.02 seconds.


Installation is pretty simple hack, just two steps.
Open the file engine/classes/templates.class.php and find:
function load_template($tpl_name) {


Add Below:
if( $this->CacheTemplate[ $tpl_name ] )      {       $this->copy_template = $this->CacheTemplate[ $tpl_name ];       return true;      }


Next (in same file) find:

$this->copy_template = $this->template;


Add Below:
$this->CacheTemplate[ $tpl_name ] = $this->template;

Author hack: REZER
Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.

Details

+5

Comments 5

Commented By Abdul Ghaffar Attari on December 1, 2011 (7:29 am)
hey i fond this line two times what to do now?

$this->copy_template = $this->template;

add new one or two times. am confused omg
4 56Forum topics : 44Forum replies : 415Forum likes : 21
spamhater
spamhater
DLE TEAM
Commented By spamhater on December 1, 2011 (8:57 pm)
Only add one under the first one that located under section:
function load_template($tpl_name) {

Do not add it under other section...this hack only for load template function...just ignore the next found...
24 386Forum topics : 12Forum replies : 950Forum likes : 130

Love is a symbol of eternity. It wipes out all sense of time, destroying all memory of a beginning and all fear of an end!
Great achievement is usually born of great sacrifice, and is never the result of selfishness...Without continual growth and progress, such words as improvement, achievement, and success have no meaning.
drinkordie
drinkordie
Members
Commented By drinkordie on February 2, 2012 (12:19 pm)
Simple but good , thanks
2 27Forum topics : 13Forum replies : 27Forum likes : 0

My new site - moviearchive.eu
newchap
newchap
V.I.P.
Commented By newchap on February 18, 2012 (6:49 pm)
guess does not work for 9.5, cuz got error..
Parse error: syntax error, unexpected '?' in /home/admin/idw/engine/classes/templates.class.php on line 50 
so i replace back the orig.
1 61Forum topics : 6Forum replies : 34Forum likes : 0
sawanbanna
sawanbanna
DLE TEAM
Commented By sawanbanna on February 18, 2012 (7:57 pm)
it maybe the code isn't clean, I have cleaned up the code above, please try again if you still have error...
31 409Forum topics : 23Forum replies : 979Forum likes : 150

« Live as if you were to die tomorrow. Learn as if you were to live forever! »
Information!Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.
DLEStarter Notice!Please note...Every hack and every module will get additional queries from your database and some hacks and some modules may result your server overload, so install only what you "need", remove any hacks and modules from your script when you don't need them, all hacks and modules appears in this website are not guaranteed by DLEStarter Team for your script security and compatibility, please read instruction carefully and use hacks and modules at your own risk...Thank you.