feulf / raintpl3

The easiest Template Engine for PHP
https://feulf.github.io/raintpl
258 stars 57 forks source link

various types of tpl folder #138

Closed prisis closed 9 years ago

prisis commented 10 years ago

I hope we can make a good solution :), My setting are like that:

if ($_ENV['SLIM_MODE'] === 'development') {
            // reconfiguring RainTPL
            $config = array(
                "base_url"  => SCRIPTPATH,
                "include_path" => array(
                ),
                "tpl_dir"  => array(
                    self::$TemplateDir . DS,
                    self::$ModulTemplateDir,
                ),
                "cache_dir" => self::$CacheTemplateDir,
                "tpl_ext" => \ConfigLoader::item('tpl_suffix', 'ConfigConfig'),
                "path_replace" => false,
                "auto_escape" => true,
                'allow_compile_once' => false,
                "debug"     => true, // set to false to improve the speed
            );

        } else {
            // reconfiguring RainTPL
            $config = array(
                "base_url"  => SCRIPTPATH,
                "include_path" => array(
                ),
                "tpl_dir"  => array(
                    self::$TemplateDir . DS,
                    self::$ModulTemplateDir,
                ),
                "cache_dir" => self::$CacheTemplateDir,
                'tpl_ext' => \ConfigLoader::item('tpl_suffix', 'ConfigConfig'),
                "path_replace" => false,
                "auto_escape" => false,
                "debug"     => false, // set to false to improve the speed
            );
        }

I have a main folder for all my tpl´s Themes/.../... and i have a module folder where all my tpl´s for my modules are. Module/.../...

if i try to load some tpl´s from module into themes tpl i always get a error "tpl not exist" because i dont use the same folder tree like themes folder.

example:

#Module {include="Content/Tpl/content"}
#Themes {include="footer"}

TPL output:

wrong <?php require $this->checkTemplate("admin/desktop/C/Content/Tpl/content");?> 
right <?php require $this->checkTemplate("admin/desktop/C/footer");?>

what i need is somthing like smarty have http://www.smarty.net/docs/en/resources.tpl#resources.file