|
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 |
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Thu Feb 08, 2018 6:07 pm Post subject: Eigenen Literal Tag erstellen |
|
|
Hallo zusammen,
wie kann ich einen eigene Block-Funktion erstellen die dann aber so "behandelt" wird wie der Literal Tag.
Was will ich tun?
Ich möchte einen scriptblock-Tag erstellen. Alles was dort eingefügt wird, wird mit einem
Code: | <script>//Inhalt des {scriptblock}</script> |
ummantelt. Jedoch ist es so, dass ich nicht einfach dort den javascript code einfügen kann, da mir dann ein compiler fehler geschmissen wird, weil eben
und
vorkommt.
Weiß jemand wie ich es umgehen kann? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Feb 08, 2018 10:29 pm Post subject: |
|
|
I'm not quite sure, what exactly are you trying to do.
Can you please elaborate, what does not work for you with {literal} tag? |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Fri Feb 09, 2018 6:23 am Post subject: |
|
|
I want create a custom block function who is working like the literal tag, so that I can insert { and } between that block element.
Example:
Code: |
{mycustomliteral}
var i = {foo:'bar'};
{/mycustomliteral}
|
But, when I create a custom block function the content will be compiled before so that I get an error. The reason is this code part:
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Feb 09, 2018 5:16 pm Post subject: |
|
|
Why you can't use an already existing block? |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Fri Feb 09, 2018 7:39 pm Post subject: |
|
|
Because I wrap it internal with a script tag automatically and I can set the "appendToEnd" property, so that the content appends to end or rendered directly on the place where it insert/added |
|
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
|