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

fetching templates via var

 
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
orthanc
Smarty n00b


Joined: 19 Aug 2004
Posts: 1

PostPosted: Thu Aug 19, 2004 2:21 pm    Post subject: fetching templates via var Reply with quote

Hi All,

I'm new to using smarty and so i may have missed something in the manual but I'm sure you lot will be able to point me in the right direction.

Simply, I want to know if its possible to pass the template to the fetch (or equivalent) method as a variable (below is only an example)

Code:

$smarty new Smarty;

$my_template = get_my_template_data();

$output = $smarty->fetch($my_template);


Am i right in thinking that the only way i'm going to be able to do this is by creating Custom resources

Many thanks
Back to top
View user's profile Send private message
dthought
Smarty Regular


Joined: 21 Apr 2003
Posts: 55
Location: Melbourne, Australia

PostPosted: Wed Aug 25, 2004 7:15 am    Post subject: Reply with quote

Not quite sure what you're doing there, but an easy example of fetch:

$mytemplate = $smarty->fetch('mytemplate.tpl');

$smarty->assign('mytemplate', $mytemplate);

$smarty->display('finaltemplate.tpl');

And inside finaltemplate.tpl:

{$mytemplate}

Pretty easy once you get the hang of it Smile
Back to top
View user's profile Send private message Visit poster's website
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