Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

TPL Resource

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Hpatoio
Smarty Rookie


Joined: 29 Apr 2003
Posts: 25
Location: Italy

PostPosted: Tue Apr 29, 2003 8:13 am    Post subject: TPL Resource Reply with quote

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
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 29, 2003 8:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Hpatoio
Smarty Rookie


Joined: 29 Apr 2003
Posts: 25
Location: Italy

PostPosted: Tue Apr 29, 2003 8:39 am    Post subject: Reply with quote

Yep, sorry, I forgot to write the resource in front of the tpl name in the post, but not in the code Shocked !!!

But anyway, the error was another one, I had some SQL error in the functions!

Sorry ...

Bye

Simone Wink
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 29, 2003 8:44 am    Post subject: Reply with quote

Glad you got it working. You might want to consider using Smarty's built-in error triggering capability to report errors in your plugins Wink.

http://smarty.php.net/manual/en/api.trigger.error.php
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP