|
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 |
Hpatoio Smarty Rookie
Joined: 29 Apr 2003 Posts: 25 Location: Italy
|
Posted: Tue Apr 29, 2003 8:13 am Post subject: TPL Resource |
|
|
Hello, I'm trying to get my templates from a DB.
I have registered a new resource to get the templates code, and when I use
$smarty->display ("my-tpl")
everything works fine.
but when I use
$smarty->Fetch ("my-tpl")
I don't get anything !
It also looks like as I don't enter the functions "db_get_template ()"
Any idea ?
Simone |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Apr 29, 2003 8:22 am Post subject: |
|
|
Hpatoio, you are very close.
Lets say your new type is named "mydb". Okay, to get templates from that resource, you use:
Code: | $smarty->display("mydb:my-tpl"); |
the mydb: part tells Smarty what resource to use to load the template from.
I think you may have mis-understood how fetch works. Fetch is used to get the output of a template without displaying it.
Code: | $output = $smarty->fetch("mydb:my-tpl");
echo $output; |
Hope that helps. |
|
Back to top |
|
Hpatoio Smarty Rookie
Joined: 29 Apr 2003 Posts: 25 Location: Italy
|
Posted: Tue Apr 29, 2003 8:39 am Post subject: |
|
|
Yep, sorry, I forgot to write the resource in front of the tpl name in the post, but not in the code !!!
But anyway, the error was another one, I had some SQL error in the functions!
Sorry ...
Bye
Simone |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
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
|