में मैं जो मैंकच्चे या पर बच शामिल टहनी
निम्नलिखित कोड शामिल कर रहा हूँ फ़ाइल "_custom_plugin_script.html.twig" में html टैग से बच नहीं होगा एक फ़ाइल, से बचने के लिए चाहते हैं। क्या कोई और तरीका है?
<pre>
{% autoescape true %}
{% include "_custom_plugin_script.html.twig" | raw %}
{% endautoescape %}
</pre>
कुछ दिनों के बाद, मुझे एक कामकाज मिला है, लेकिन जवाब नहीं है। तो पहले कच्चे भाग नहीं बचेंगे इसलिए मुझे भागने का उपयोग करना चाहिए। हालांकि कच्चे और भागने {%%} के भीतर काम नहीं करेंगे लेकिन {{}} में।
तो यहाँ वैकल्पिक हल कार्रवाई
$customPluginScript = $app['twig']->render('_custom_plugin_script.html.twig', array(
'data' => $data,
));
return $app['twig']->render('confirm.html.twig', array(
'data' => $data,
'customPluginScript' => $customPluginScript
));
की
सामग्री और confirm.html.twig
<script>
// don't escape content of customPluginScript
{{ customPluginScript | raw }}
</script>
<!-- escape content of customPluginScript -->
<pre>
{{ customPluginScript }}
</pre>
['{{var | raw}}'] (http://twig.sensiolabs.org/doc/filters/raw.html) जब मैं Google के माध्यम से यह प्रश्न प्राप्त करता था तब मैं देख रहा था। –