php - Display twig code written in a twig file -


i writting tutorial , need display twig code... problem: i'm writting twig code on twig view, need find way write raw, without interpretation.

currently, using twig extension job:

$path = $this->kernel->locateresource($path, null, true); return file_get_contents($path); 

but i'm wondering if there better solutions.

found it. twig has built-in tag to job : verbatim.

{% verbatim %}     <ul>     {% item in seq %}         <li>{{ item }}</li>     {% endfor %}     </ul> {% endverbatim %} 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -