php - how can i request a variable in my home.ctp of my cakePHP application? -


I created a page using the MVC structure called 'section' (see the App / View / Section folder, located in the model Is the model folder and the controller in the controller folder) When I request a variable $ test, it works fine without any error ..

When I want to request this variable in my home .tpt, I have been told with an error that the variable is undefined ..

Any no way to request this variable on the page in Eepiacpi you want?

Thnx in advance! In the MVC stack, you have to set the variable with the data of your controller, and then they have to pass them. Your View

So in your example, you can $ this-> Set ('myvar', $ item); your section controller , then in your view, you will be able to $ myvar echo .

Make sure your sec controller is set to home () method, otherwise it is not available in your home view Will happen.


Comments