I'm trying to use load_class to load mthaml as I understood it's necessary for performance reasons.
This is the MtHaml library. https://github.com/arnaud-lb/MtHaml
It's namespaced everywhere so getting it working with load_class natively hits the first hurdle. Then it gets instantiated through Autoloader.php which does
namespace MtHaml;
class Autoloader
{
static public function register()
{
spl_autoload_register(array(new self, 'autoload'));
}
static public function autoload($class)
{
if (strncmp($class, 'MtHaml', 6) !== 0) {
return;
}
if (file_exists($file = __DIR__ . '/../' . strtr($class, '\\', '/').'.php')) {
require $file;
}
}
I'm trying
load_class('Autoloader', 'libraries/MtHaml', '');
But that gives me Fatal error: Class 'Autoloader' not found
Then if I try
load_class('MtHaml\Autoloader', 'libraries/MtHaml', '');
I get Unable to locate the specified class: MtHaml\Autoloader.php
Right now the only way I got this working is by calling it like so
require_once __DIR__ . '/../libraries/MtHaml/Autoloader.php';
MtHaml\Autoloader::register();
$haml = new MtHaml\Environment('php');
$rendered = $haml->compileFile($haml_file, $haml_cache_path);
The problem being this piece of code is ran anytime I call my $this->load->view in code igniter so I understood load_class was needed to optimize performance as in one controller I could be calling $this->load->view several times.
How do I use load_class with this?