PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Smarty Templates from Database
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Smarty Templates from Database

Réponse
 
LinkBack Outils de la discussion
Vieux 17/01/2008, 11h01   #1
Bruno Rafael Moreira de Barros
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Smarty Templates from Database

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?
  Réponse avec citation
Vieux 17/01/2008, 13h49   #2
pritaeas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Smarty Templates from Database


"Bruno Rafael Moreira de Barros" <brunormbarros@gmail.com> wrote in message
news: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/sect...ndler.func.php


  Réponse avec citation
Vieux 18/01/2008, 12h11   #3
Bruno Rafael Moreira de Barros
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Smarty Templates from Database

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/sect...ndler.func.php


What about the compiled TPL files?
  Réponse avec citation
Vieux 21/01/2008, 08h32   #4
pritaeas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Smarty Templates from Database


"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/sect...ndler.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:W...n&ct=clnk&cd=2


  Réponse avec citation
Vieux 28/01/2008, 10h03   #5
Bruno Rafael Moreira de Barros
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Smarty Templates from Database

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/sect...ndler.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:W...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...
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h02.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17411 seconds with 13 queries