php - one variable and multiple controllers -


I am working on a web application, which is using KKHP framework. For here I have to request a variable on multiple pages (all pages contain different controllers) It is suspected that I get an error on many pages, since the variable is not declared in all the different controllers.

Is there an alternative solution for this? I have already tried app :: Import to import a controller in a controller, but it does not seem to work (still get an undefined variable error).

Thnx for your cooperation!

Regards, Simon

, but I think it's a little better I will paste my answer here:

Standing on the shoulder of the comment of deception and answering David Yale, I think about what he is trying to do to you. Have managed to move a decent scene. Maybe. By default, the PagesController :: display () method home page view ( Home.ctp ). I suspect what you are talking about, he said, that the variable you are setting in your method of any of your section controller will not be available on your homepage which is in a separate controller If you want to make a variable available for all the visuals, there are several things you can do:

  1. You can create your own config / core.php < / Code> can set the variable in the file (usually not uni Satisfied)
  2. You can set it in config / bootstrap.php if it is static by this, I mean this is a value that you go to hard code There are nothing, generated in dynamic way. No matter what you make a variable, no matter what.
  3. You can set your AppController to before filter () or first render () method all your custom controllers (Assuming you have followed the protocol) you get from AppController if you select this path, then the cake / Libby / controller / app_transfer.php Copy and place it in your app / directory.

These are the ways in which I think they will meet your needs as I understand them.


Comments