PHPainfree2 Docs

$Painfree->autoload() - Documentation | PHPainfree2

PHPainfree2 $Painfree->autoload()

$Painfree->autoload() : void

$Painfree->autoload() : void

This function is called automatically by PHPainfree2 and loads the defined BaseView.

Design Theory

The reason that this program is executed outside of the PHPainfree class is so that all imported scripts loaded by the autoloader will be executed in the global PHP scope.

WARNING

This is an internal function to PHPainfree2 and is not meant to be called by applications.

$Painfree->autoload()

// process Autoload folder
$loaders = $Painfree->autoload();
foreach ( $loaders as $load ) {
	include $load;
}

public function autoload() {
	// process Autoload folder
	$auto_load_path = $this->Root . $this->options['LogicFolder'] . '/Autoload/*.php';
	$loaders = glob($auto_load_path);
	if ( is_array($loaders) && count($loaders) ) {
		foreach ( $loaders as $autoload ) {
			list($junk,$file_name) = explode('Autoload/', $autoload);
			$this->Autoload[$file_name] = $autoload;
		}
	}

	return $this->Autoload;
}
$Painfree->autoload()
What Where How
Loaded includes/Autoload/ *.php
Called Painfree.php $Painfree->autoload();
PHPainfree/
|-- htdocs/
|-- includes/
|   |-- PainfreeConfig.php
|   |-- Painfree.php
|   |-- App.php
|   `-- Controllers/
`-- templates/
    |-- app.php
	`-- autoloads/
	    `-- main.php