You are here: Re: Smarty Templates from Database « PHP Programming Language « IT news, forums, messages
Re: Smarty Templates from Database

Posted by pritaeas on 01/21/08 08:32

"Bruno Rafael Moreira de Barros" <brunormbarros@gmail.com> wrote in message
news: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/%3Fpage%3DSmartyFrequentlyAskedQuestions+smarty+compiled+tpl+database&hl=en&ct=clnk&cd=2

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация