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

Переменная в переменной

 
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 -> Language: Russian
View previous topic :: View next topic  
Author Message
kenny_sk8
Smarty Rookie


Joined: 04 Aug 2006
Posts: 5

PostPosted: Fri Aug 04, 2006 5:12 pm    Post subject: Переменная в переменной Reply with quote

У меня есть в базе данных тексты. в тексте могут встречаться перменные смарти.
Мне нужно штобы эти переменные воспринялись смарти.

В данный момент всё происходит так:

$q = $sql->quey('запрос');
$r = $sql->fetch_assoc($q);
$smarty -> assign('content',$r['content']);
//Внутри $r['content'] находится {$link}
$smarty->assign('link','http://'.getenv('SERVER_NAME'));
$smarty->display('index.tpl');

В итоге получаю в отображаемой странице {$link} а не 'http://site_name.com/'

Как сделать так чтобы такие переменные в подстановке парсились?
Если делать fetch, а потом заменять, это косяк, так как вдруг переменной нету вообще.
Back to top
View user's profile Send private message
hayk
Smarty Rookie


Joined: 23 Jun 2006
Posts: 5
Location: ExUSSR

PostPosted: Tue Aug 08, 2006 8:38 pm    Post subject: Reply with quote

Смотри eval.
Back to top
View user's profile Send private message Visit poster's website
kenny_sk8
Smarty Rookie


Joined: 04 Aug 2006
Posts: 5

PostPosted: Sat Aug 12, 2006 1:15 pm    Post subject: Reply with quote

Нифига не прёт. Вообщем не понял причём тут eval так как он не ловит переменные в переменно тоже. всё что в пременной не парсится. Вот в чём трабла. предлоди лучше код с примером, может я просто чёт не понимаю в eval
Back to top
View user's profile Send private message
hayk
Smarty Rookie


Joined: 23 Jun 2006
Posts: 5
Location: ExUSSR

PostPosted: Sat Aug 12, 2006 8:16 pm    Post subject: Reply with quote

Непонятно что непонятно и непонятно почему непоятно причем тут eval если в мануеле и так все расписано.
index.php
Code:
$smarty->assign ('domain', 'a13n.org');
$smarty->assign ('title', 'Welcome to {$domain} home page!');

index.tpl
Code:
1. {$title} <br />
2. {eval var=$title} <br />
3. {eval var=$title assign=evaltitle} {$evaltitle} <br />
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 -> Language: Russian 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