M
M
Maxim Lagoysky2019-04-25 16:49:34
symfony
Maxim Lagoysky, 2019-04-25 16:49:34

How to create a service that displays small html?

Good evening everyone, I want to create a service for displaying a menu. I create the service itself and when it is called in the controller it works, but how to set up the service so that you can call it in the template, Something like this

<div>
    {{ my_menu }}
</div>

I just put "knpmenubundle" and there the menu was displayed like that, it became interesting how it's done, and then I think this knowledge will come in handy.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2019-04-25
@lagoy

Create a Twig Extension

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question