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

smarty tags in db?

 
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
Cronet
Smarty Rookie


Joined: 21 May 2003
Posts: 15

PostPosted: Thu May 22, 2003 11:59 am    Post subject: smarty tags in db? Reply with quote

Hi There,

i want to store the complete <body> tag of a site in a DB.

my tpl looks like this:

Code:
{include file="header.tpl"}
{$body}
{include file="footer.tpl"}


but smarty doesn't interprate tags coming from the db.

e.g. <img src="{$rel_path}/site/pictures/all.jpg">

how to realize this?

Greets from Germany,
Cronet
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu May 22, 2003 12:45 pm    Post subject: Reply with quote

you want your body-tag to be a resource. see:
http://smarty.php.net/manual/en/templates.from.elsewhere.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cronet
Smarty Rookie


Joined: 21 May 2003
Posts: 15

PostPosted: Thu May 22, 2003 4:43 pm    Post subject: Reply with quote

Is there a another way??

Much effort for only one variable... Smile

It's really only the {$rel_path} for images that i need to grab...

Hm.. but to tell the truth.. i think I didn't understand that way in my case...

Greets
Cronet
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu May 22, 2003 4:58 pm    Post subject: Reply with quote

hmm,

you can use eval http://smarty.php.net/manual/en/language.function.eval.php
but that is slow.

or you can search and replace {$rel_path} in php with str_replace or preg_replace before you assign $body to smarty. but that won't scale if your demands start to grow, and you want to do more smarty-stuff in your $body.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cronet
Smarty Rookie


Joined: 21 May 2003
Posts: 15

PostPosted: Thu May 22, 2003 5:10 pm    Post subject: Reply with quote

Hi messju,

thanks for replaying..

I think the search and replace way is for me the best at the momen...
Thats my first experiences with smarty.. and I think time brings experience...

Thanks for your help

Greets Cronet
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