|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jay Smarty n00b
Joined: 08 Apr 2005 Posts: 3
|
Posted: Fri Apr 08, 2005 4:55 pm Post subject: .tpl from database instead from files? |
|
|
Is it possible to load templates from a database?
somethingh like
Code: | $smarty->display($template_variable); |
instead of
Code: | $smarty->display('template.tpl'); |
?[/code] |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
Back to top |
|
lucianl Smarty n00b
Joined: 10 Apr 2005 Posts: 2 Location: Iasi, Romania
|
Posted: Sun Apr 10, 2005 12:18 pm Post subject: Not so sure about that... |
|
|
I will not be so sure about that, i tried to use the method display taking as argument a database resource, something like $my_smarty->display($template_to serve), where $template_to_serve = "db:$template".
Working this way isn't accepted by Smarty engine, still trying to figure out the problem.
However, if I use directly $my_smarty->display("db:index"), where 'index' is the name of the template, it works.
Any idea? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Apr 10, 2005 7:38 pm Post subject: |
|
|
hmmm. It works for me. Can you demonstrate your problem? ie. post your resource and sample (and failed) cases? |
|
Back to top |
|
lucianl Smarty n00b
Joined: 10 Apr 2005 Posts: 2 Location: Iasi, Romania
|
Posted: Mon Apr 11, 2005 7:30 pm Post subject: Problem seemed to be solved... |
|
|
Hello!...
Thanx for quick answer and sorry for my delay.
I have a class that, depending of the URI, had to load a certain template from database.
I had rewritten the class and its methods, and now it works.
In previous one, the template was loaded, in that template some variables were assigned, and the same template is used for display() method.
Still don't know why it works now, the code it's the same for 90%.
Thanx a lot!...Happy coding!
One more thing : I have a class that is registering as resource a database. Everything is ok for now, but if I have another class that extends the first class, that resource is not longer available for extended class.I have to implement it again... |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|