Twig write from Yaml file

symfony, twig, yaml

Solution

OK i solved this is twig file:

locale: {{files["locale"]}}<br>
codes:<br>
 {% for file in files %}
  {% for code,value in file  %}
  &nbsp;{{code}}: {{value}}<br>
  {% endfor %}
 {% endfor %}

Problem

I have this problem: My yaml file: ``` locale: en codes: button.cancel: Cancel button.accept: Accept radio.male: Male radio.female: Female ``` I need to write all of yaml file into my page controller action: ``` /** * @Route("/read/") * @Template() */ public function readAction() { $yaml = new Parser(); $file = $yaml->parse(file_get_contents(getcwd() .'/file.yml')); return $this->render('AnyoneYamlGeneratorBundle:GenerateController:read.html.twig', array( 'files' => $file, )); } ``` my twig file: ``` {% for file in files %} {% for key,value in file %} {{key}}: {{value}}<br> {% endfor %} {% endfor %} ``` answer of my browser is ``` button.cancel: Cancel button.accept: Accept radio.male: Male radio.female: Female ``` and i need all of my yaml file Thanks for help

Original source