|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ferre Smarty Rookie
Joined: 07 Jul 2003 Posts: 28
|
Posted: Thu Aug 21, 2003 5:27 am Post subject: problem about literal |
|
|
if i have a file name abc.php
the content is
<?
$message="
welcome {$username} !!
";
?>
i include(abc.php) in php file and
$s->assign("MSG",$message);
how to let it's show on [html form textfiled]
display like this
------------------------------------------
welcome {$username} !!
------------------------------------------
thz ^_^.....for all |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Aug 21, 2003 9:53 am Post subject: |
|
|
Hi ferre.
The thing is that when you assign $message you are using double quotes and 'curly syntax' (more here) which means that PHP replaces the {$username} with whatever is the value of the PHP variable $username in the current scope. In your example, that would mean that $message is assigned to {$MSG} as welcome !!.
Try this:[php:1:40244273ab]<?php
$message='welcome {$username} !!';
?>[/php:1:40244273ab]
Note the single quotes--they tell PHP not to do the variable replacement.
But all that assumes that you wanted to {$MSG} to literally result in welcome {$username} !! at template runtime.
HTH |
|
Back to top |
|
ferre Smarty Rookie
Joined: 07 Jul 2003 Posts: 28
|
Posted: Fri Aug 22, 2003 9:44 am Post subject: |
|
|
thx for reply so soon....it's work , thz man |
|
Back to top |
|
|
|
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
|