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

Smarty, JavaScript und die Zeilenumbrüche

 
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 -> Language: German
View previous topic :: View next topic  
Author Message
ITrun90
Smarty n00b


Joined: 15 Sep 2014
Posts: 1

PostPosted: Mon Sep 15, 2014 5:14 pm    Post subject: Smarty, JavaScript und die Zeilenumbrüche Reply with quote

Ich habe folgendes Problem:

Aus einem Textfeld heraus speicher ich einen Text in einer Datenbank. Diesen Text lade ich in einer PHP - Datei und übergebe Ihn an Smarty.

Dann möchte ich diesen Text gerne in JavaScript benutzen. Leider wird das Script nicht ausgeführt (und alles was nach dem Script komm auch nicht).

Nehmen wir mal diesen Text:

"Umbruch

Umbruch"

Ich habe es schon mit |nl2br probiert. Dann passiert folgendes:

"Umbruch<br />
<br />
Umbruch"

Damit JavaScript aber damit ordentlich arbeiten kann, sollte es so aussehen:

"Umbruch<br /><br />Umbruch"

Nur weiß ich nicht, wie ich das hinbekomme.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed Sep 17, 2014 1:50 pm    Post subject: Reply with quote

Das hat erstmal nichts mit Smarty zu tun sondern mit JavaScript. Du kannst eben keine "umbrüche" in JavaScript habe, außer du machst immer ein \ (Backslash) davor: siehe hier: http://css-tricks.com/snippets/javascript/multiline-string-variables-in-javascript/
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 -> Language: German 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