Set variable to template

Asked

Viewed 145 times

0

I need to define a variable that will be displayed in the footer of all my pages, ie in the cake 3 template. Any ideas?

1 answer

1


You have to see the situation, there are several ways to do this, one of them is to pass the beforeRender or Appcontroller initialize, and set the variable there, so that all system views have access.

  • Yes, I’m currently doing it for the Appcontroller beforeRender, but I still think there should be some better and more specific way. I’m passing unnecessary variables to views that don’t use this layout.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.