php - do things with the return value of smarty function? -


we have smarty function returns html code templates. possible function returns null string, wish identify. our system has been running stably years, looking least invasive possible solution.

is possible assign return value smarty variable? have tried assigning javascript variable, however, because part of html user generated, return string mixture of double , single quotes, causes problems in ie (unfortunately majority of our user base).

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

any appreciated!

use escape modifier, example:

{$variable|escape:'quotes'} 

for smarty function, can first try if {smarty_function|escape:'quotes'} works, if doesn't have assign output of function variable first before escaping it, , use capture:

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

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -