-1

This is my iframe code in my base template:

<iframe id="main" src="{{ app.request.getBaseURL() }}/include/main.html.twig"></iframe>

In my app folder I have another folder named include/ that has a twig file named main.html.twig.

I want to include the main.html.twig file in src like this:

<iframe id="main" src="/include/main.html.twig"></iframe>
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257

1 Answers1

1

It won't work this way . You cannot/shouldn't directly link to twig files. That is what you need to do :

  • Create new action in controller , that will render that main.html.twig, and name it. (read about routing and @Route annotation)
  • in iframe you need to use src="{{ path('route_name_to created action') }}"
Michał G
  • 2,234
  • 19
  • 27