|
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 |
dhairy Smarty n00b
Joined: 25 Feb 2009 Posts: 1
|
Posted: Wed Feb 25, 2009 5:18 pm Post subject: html tags getting lost in smarty variables |
|
|
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 |
|
jothirajan Smarty Pro
Joined: 06 Feb 2009 Posts: 114 Location: India
|
Posted: Thu Feb 26, 2009 5:09 am Post subject: Re: html tags getting lost in smarty variables |
|
|
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
My Output
Code: |
This is text
with a linebreak. |
|
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Thu Feb 26, 2009 11:41 am Post subject: Your smarty config does not seem normal. |
|
|
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 |
|
|
|
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
|