|
Posted by Bruno Rafael Moreira de Barros on 09/28/37 12:01
On Jan 21, 8:32 am, "pritaeas" <prita...@home.nl> wrote:
> "Bruno Rafael Moreira de Barros" <brunormbar...@gmail.com> wrote in messagenews:d5e6ed5f-5147-41d3-abfc-0ff7b0c184d3@e25g2000prg.googlegroups.com...
>
>
>
> > On Jan 17, 1:49 pm, "pritaeas" <prita...@home.nl> wrote:
> >> "Bruno Rafael Moreira de Barros" <brunormbar...@gmail.com> wrote in
> >> messagenews:1d4f374d-5e28-415c-b2d2-2a6a1ede3dd2@l1g2000hsa.googlegroups.com...
>
> >> > Smarty, on the readme, says it is able to get template from arbitrary
> >> > sources, file system or database. I have seen $default_resource_type
> >> > and it can be file: or db:...
>
> >> > After searching the documentation, I found:
>
> >> >http://www.smarty.net/manual/en/template.resources.php
>
> >> > But then, where is it cached and compiled? Is there a way to run
> >> > Smarty 100% from the database?
>
> >> If you also want to cache to the
> >> database:http://www.smarty.net/manual/en/section.template.cache.handler.func.php
>
> > What about the compiled TPL files?
>
> Found this:
>
> Q: Can I force Smarty to store compiled templates into database rather than
> file on the disk?
> A: Not yet... But perhaps you could find someone to implement it ;)
>
> A: You shouldn't, it will be a great performance disadvantage, because PHP
> cannot execute them directly from database.
>
> A: Technically, you can use PHP's recently added streams API to implement
> your storage type at the PHP level. This would enable PHP to include your
> code just as if it was a local file; unfortunately, this isn't trivial to
> implement and would likely require some customizations to Smarty as well.
>
> A: Ugly hack, but I guess it works for sending the compiled code to a
> string:
>
> function compile_to_string(&$smarty, $filename) {
>
> $_params = array('resource_name' => $filename);
>
> $smarty->_fetch_resource_info($_params);
>
> $smarty->_compile_source($filename, $_params['source_content'],
> $compiled_content);
>
> return($compiled_content);}
>
> Here:http://66.102.9.104/search?q=cache:WnhTq3VcvYwJ:smarty.incutio.com/%3...
Yeah I have noticed it is extremely hard, and it's useless. Imagine
the images, that are not required by PHP, but are required by the
client, using HTML. They would be on the database... I'm using Smarty
in normal directories now...
Navigation:
[Reply to this message]
|