Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
[Need help] Text with first line break, fill in textarea

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
deateam
Smarty n00b


Joined: 27 Apr 2010
Posts: 4

PostPosted: Tue Apr 27, 2010 2:28 am    Post subject: [Need help] Text with first line break, fill in textarea Reply with quote

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
View user's profile Send private message
deateam
Smarty n00b


Joined: 27 Apr 2010
Posts: 4

PostPosted: Tue Apr 27, 2010 6:43 am    Post subject: Reply with quote

Crying or Very sad
Anybody help me????
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 521

PostPosted: Tue Apr 27, 2010 10:05 am    Post subject: Reply with quote

this is an html problem, not a smarty one. but, this should work:

Code:

<textarea>
{$myText}</textarea>
Back to top
View user's profile Send private message
deateam
Smarty n00b


Joined: 27 Apr 2010
Posts: 4

PostPosted: Tue Apr 27, 2010 10:21 am    Post subject: Reply with quote

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 Sad
Back to top
View user's profile Send private message
douglassdavis
Smarty Junkie


Joined: 21 Jan 2008
Posts: 521

PostPosted: Tue Apr 27, 2010 10:33 am    Post subject: Reply with quote

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 Sad


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
View user's profile Send private message
deateam
Smarty n00b


Joined: 27 Apr 2010
Posts: 4

PostPosted: Wed Apr 28, 2010 1:31 am    Post subject: Reply with quote

@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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development 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