Skip to content
Snippets Groups Projects
Commit f83f0fd0 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

support autoloading for templates

similar to what is possible for plugins, templates can now autoload
namespaced classes, too. the namespace is
dokuwiki\template\<templatename>
parent 71de5572
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,16 @@ function load_autoload($name){ ...@@ -121,6 +121,16 @@ function load_autoload($name){
} }
} }
// template namespace
if(substr($name, 0, 18) == 'dokuwiki/template/') {
$name = str_replace('/test/', '/_test/', $name); // no underscore in test namespace
$file = DOKU_INC.'lib/tpl/' . substr($name, 18) . '.php';
if(file_exists($file)) {
require $file;
return true;
}
}
// our own namespace // our own namespace
if(substr($name, 0, 9) == 'dokuwiki/') { if(substr($name, 0, 9) == 'dokuwiki/') {
require substr($name, 9) . '.php'; require substr($name, 9) . '.php';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment