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

html tags getting lost in smarty variables

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
dhairy
Smarty n00b


Joined: 25 Feb 2009
Posts: 1

PostPosted: Wed Feb 25, 2009 5:18 pm    Post subject: html tags getting lost in smarty variables Reply with quote

hello,

I facing this problem. My html tags are getting lost when I copy the content to smarty variable.
I want to put Content with some HTML-Tags in Smarty Variables, but it get lost.

-- Example:

...

//PHP:
$content = "This is text<br>with a linebreak.";
$smarty->assign('content',$content);

//Smarty:
<p>{$content}</p>

//Output (HTML)
<p>This is textwith a linebreak.</p>

...

-- End of example

There is no <br> Tag after showing the content. Is the showing of HTML-Tags an configuration option in smarty (and where can I find and tune it) or does smarty delete HTML-Tags in content anytime?


It will be great if some one could come up with a solution.
Back to top
View user's profile Send private message
jothirajan
Smarty Pro


Joined: 06 Feb 2009
Posts: 114
Location: India

PostPosted: Thu Feb 26, 2009 5:09 am    Post subject: Re: html tags getting lost in smarty variables Reply with quote

dhairy wrote:
hello,

I facing this problem. My html tags are getting lost when I copy the content to smarty variable.
I want to put Content with some HTML-Tags in Smarty Variables, but it get lost.

-- Example:

...

//PHP:
$content = "This is text<br>with a linebreak.";
$smarty->assign('content',$content);

//Smarty:
<p>{$content}</p>

//Output (HTML)
<p>This is textwith a linebreak.</p>

...

-- End of example

There is no <br> Tag after showing the content. Is the showing of HTML-Tags an configuration option in smarty (and where can I find and tune it) or does smarty delete HTML-Tags in content anytime?


It will be great if some one could come up with a solution.




Happy coding

See I am getting the accurate result

My php file:
Code:
$content = "This is text<br>with a linebreak.";
echo $content;
$objSmarty->assign("content",$content);


My Tpl file
Code:
{$content}



My Output
Code:

This is text
with a linebreak.
Back to top
View user's profile Send private message Send e-mail
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Thu Feb 26, 2009 11:41 am    Post subject: Your smarty config does not seem normal. Reply with quote

On a normal installation of Smarty, this should not happen, and you have done it the right way.

However, there are may things to consider:
You might have stripped your tags somewhere, unknowingly, before displaying your tags.

Just a nice friendly suggestion: Try it with a fresh installation of Smarty files.
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 -> Tips and Tricks 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