raintpl3 icon indicating copy to clipboard operation
raintpl3 copied to clipboard

Patches for split_parser branch - fixed one bug in include tag and added include_path

Open keskad opened this issue 11 years ago • 7 comments

Hello.

RainTPL just stopped working with include tags. So I fixed the problem and added new option "include_path" that will allow searching for template to include in many diffirent paths. It will not slow down template engine as it's only doing once (when template is going to be compiled).

I will add also two configuration options "force_compile" and "dont_compile". The first one will be for debugging purposes (I have save a template file everytime I want to debug parser... it's annoying) and the second one will allow compiling templates from crontab.

@edit Removed "force_compile" as there is already "debug" option that provides same feature. Added "allow_compile" and "allow_compile_once" - with True values by default.

keskad avatar Sep 22 '13 14:09 keskad

how can i include a full path?

because if i use multi tpl_dir and dont have the same folders

something like that

Modul/Content/Tpl/content.html

and my base folder

Themes/public/desktop/test/index.html

i need content from folder A in index from folder B, when i use {include = "Content/Tpl/content"} i get a error that TPL can find that template

prisis avatar Oct 24 '13 20:10 prisis

I'll work on this issue, thanks for reporting it.

On Thu, Oct 24, 2013 at 4:50 PM, prisis [email protected] wrote:

how can i include a full path?

because if i use multi tpl_dir and dont have the same folders

something like that

Modul/Content/Tpl/content.html

and my base folder

Themes/public/desktop/test/index.html

i need content from folder A in index from folder B, when i use {include = "Content/Tpl/content"} i get a error that TPL can find that template

— Reply to this email directly or view it on GitHubhttps://github.com/rainphp/raintpl3/pull/118#issuecomment-27028618 .

feulf avatar Oct 24 '13 21:10 feulf

Hi @rainphp , did you find a solution for me problem?, im trying my self but i dont have any luck -.-

prisis avatar Nov 24 '13 21:11 prisis

Hey @prisis, I've implemented the absolute path in this pull request. This will fix your problem: https://github.com/rainphp/raintpl3/pull/128

Let me know if works and I'll merge the pull request.

feulf avatar Nov 25 '13 05:11 feulf

I will take a look at this code today and figure out how to solve your problem.

keskad avatar Nov 25 '13 08:11 keskad

i will take a look too :), the best opinion were if you can set more folders and loop through all folder if the tpl exist, but i will test you code,

example: 
"include_path" => array(
                  self::$ModulTemplateDir,
               ),
"tpl_dir"  => array(
  self::$TemplateDir . DS,
  ),

{include="Content/Tpl/content'"} => PUBPATH . 'Modul' . DS . 'Content/Tpl/content.html'

{include="footer"} => PUBPATH . 'Themes/Admin/Test/footer.html'

prisis avatar Nov 25 '13 08:11 prisis

@prisis I'm against adding more configurations or features, this will work for you:

'tpl_dir' => array(
    self::$TemplateDir . DS,
    self::$ModulTemplateDir,
);
{include="Content/Tpl/content"}
{include="footer"}

feulf avatar Nov 25 '13 16:11 feulf