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

problem about literal

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


Joined: 07 Jul 2003
Posts: 28

PostPosted: Thu Aug 21, 2003 5:27 am    Post subject: problem about literal Reply with quote

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
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Aug 21, 2003 9:53 am    Post subject: Reply with quote

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. Smile

HTH
Back to top
View user's profile Send private message
ferre
Smarty Rookie


Joined: 07 Jul 2003
Posts: 28

PostPosted: Fri Aug 22, 2003 9:44 am    Post subject: Reply with quote

thx for reply so soon....it's work , thz man
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