 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
deateam Smarty n00b
Joined: 27 Apr 2010 Posts: 4
|
Posted: Tue Apr 27, 2010 2:28 am Post subject: [Need help] Text with first line break, fill in textarea |
|
|
Hi, I'm new. My situation is, I have a text variable read from php/mySQL with a first line break, like this:
| Code: | --Line break--
Line2: abcd
--Line break--
Line4: efgh |
(I wrote --Line break-- for clearly imagining)
When i use smarty to put $myText into HTML textarea like this:
| Code: |
<textarea>{$myText}</textarea> |
The first linebreak will not be shown correctly. It shows:
| Code: | Line2: abcd
--Line break--
Line4: efgh |
(I've tried to display by a div, it appears ok.)
Would you show me how to display the first line break correctly as I want?
Many thanks. |
|
| Back to top |
|
deateam Smarty n00b
Joined: 27 Apr 2010 Posts: 4
|
Posted: Tue Apr 27, 2010 6:43 am Post subject: |
|
|
Anybody help me???? |
|
| Back to top |
|
douglassdavis Smarty Junkie
Joined: 21 Jan 2008 Posts: 521
|
Posted: Tue Apr 27, 2010 10:05 am Post subject: |
|
|
this is an html problem, not a smarty one. but, this should work:
| Code: |
<textarea>
{$myText}</textarea>
|
|
|
| Back to top |
|
deateam Smarty n00b
Joined: 27 Apr 2010 Posts: 4
|
Posted: Tue Apr 27, 2010 10:21 am Post subject: |
|
|
I've traced the code then found out that Smarty doesnt causes the problem. Maybe textarea tag does.
@douglassdavis: Thanks for replying. But that doesnt work  |
|
| Back to top |
|
douglassdavis Smarty Junkie
Joined: 21 Jan 2008 Posts: 521
|
Posted: Tue Apr 27, 2010 10:33 am Post subject: |
|
|
| deateam wrote: | I've traced the code then found out that Smarty doesnt causes the problem. Maybe textarea tag does.
@douglassdavis: Thanks for replying. But that doesnt work  |
without the smarty, if you make a textarea
| Code: |
<textarea>
first text
second text</textarea>
|
(notice position of line breaks)
You get a line break before "first text" right? Start with the HTML you want, then work backwards, adding smarty to achieve that result. Are you sure that line break is being output in the HTML when you use smarty? |
|
| Back to top |
|
deateam Smarty n00b
Joined: 27 Apr 2010 Posts: 4
|
Posted: Wed Apr 28, 2010 1:31 am Post subject: |
|
|
@douglassdavis: I've tried to put $myText (by Smarty) to a <div> besides that textarea, then it display correctly as I want. So I said that textarea causes the problem. The situation here, is displaying $myText in a textarea with smarty. I know my problem.
Anw, thanks for replying. |
|
| 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
|