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

Two questions...

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


Joined: 07 May 2003
Posts: 3

PostPosted: Wed May 07, 2003 12:32 pm    Post subject: Two questions... Reply with quote

Hi, I have 2 questions....

1. Can I some way insert smarty teplate tags to variable values. Example, I get content from DB what contains {xxxx} - tags in it. But how can I tell to Samrty that it will compile these tags too?
$smarty->assign('content', $fromDB);
$smarty->display('my.tpl');
This will output all tags without compiling them! Compiles only tags what are in template file not these what are in $fromDB .... Sad


2. Can I somehow get list of all variables what are in template file. Not assigned variables.

Thanx.
Back to top
View user's profile Send private message
Brian
Smarty Rookie


Joined: 29 Apr 2003
Posts: 21

PostPosted: Wed May 07, 2003 4:59 pm    Post subject: Reply with quote

See here:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=241
Back to top
View user's profile Send private message Send e-mail
boots
Administrator


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

PostPosted: Wed May 07, 2003 11:38 pm    Post subject: Reply with quote

Hi muhv.

For the first part, it sounds like you want to {include} a template from your db. You can do this by writing a custom resource that fetches loads template data from your db instead of the filesystem.

See: http://smarty.php.net/manual/en/templates.from.elsewhere.php

As for your second question, if you mean, "Does Smarty have a function to return all variables used in a template" the answer is No. But if you use the object technique that Brain pointed you to, you can do something similar.
Back to top
View user's profile Send private message
muhv
Smarty n00b


Joined: 07 May 2003
Posts: 3

PostPosted: Thu May 08, 2003 7:57 am    Post subject: Reply with quote

Great thanx!

This solution works for me ..... Smile
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