I am trying to use variables available in all views of my application and thought set_global is the best method, isn't it ?
I tried View::Set_global('test','test); like explained in the documentaiton and in some forum articles, and tried to write it everywhere like before function, or any controller. I can't find my variable $test in any view, I always have an error saying undefined vaiable.
example : I set my global var in controller A methode action_index. I want to access to it in any view B dependent from controller B.
There must be something I missed or don't understand, any idea ?
PHP is stateless, so everything you do is within the scope of the request. Once that finishes PHP will forget everything. This is why you need a session to pass data from one request to the next.
So controller B (assuming that is a second request from the browser) is unaware of other requests, it will not have access to data set in another request.