Do things with smarty function return value?

We have this Smarty function that returns HTML code for templates. However, it is also possible that the function returns an empty string, which we now want to identify. Our system has been stable for many years, so I am looking for the least invasive solution possible.

Is it possible to assign a return value to a smarty variable? I tried to assign it to a Javascript variable, however, since part of the HTML is created by the user, the returned string may be a mixture of double and single quotes, which causes problems in IE (unfortunately, most of our user base).

<script type="text/javascript">
var html = '{smarty function}'; //IE chokes on mixed quotes
</script>

Any help appreciated!

+3
source share
1

escape, :

{$variable|escape:'quotes'}

smarty , {smarty_function|escape:'quotes'} , , , capture:

 {capture name=mycapture}{smarty_function}{/capture}
 {$smarty.capture.mycapture|escape:'quotes'}
+6

Source: https://habr.com/ru/post/1728131/


All Articles