Jump to content

Recommended Posts

I have three files  index.php, loader.php and BasePresenter.php. In directory Templates / layouts I have 2 file, index.php and header.php like a template files. How Can I automaticaly loaded these files with autoload function from BasePresenter? Thx

 

index.php

<?php


    // index.php


    // loader


    require_once 'loader.php';
     
    new BasePresenter();
      
     
?>

loader.php

 

<?php


// [ LIBS ]


                // notORM


                require_once 'libs/NotORM.php';


// [ MODELS ]


                // database


                require_once 'models/db.php';
                
                
 // [ PRESENTERS ]


                // base presenter


                require_once 'presenters/BasePresenter.php';
               
?>

BasePresenter.php

 

<?php


class BasePresenter {
    
    public function __construct( ) {
        
        function __autoload($class_name) {
    require_once($class_name.".php"); 
}


    
    
} }


?>
 
Edited by OOPBeginner
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.