I am having a problem with the following In my controler I am having $this->template->content = View::forge('profile/index', $data); where $data is a table of strings like : $data['welcome_Text'] = 'hello'; $data['lbl_pseudo'] = 'John Doe';
in my template I have <?php echo $content ; ?>
And this is working well and displays my page. The problem is when I just refresh that page with the refresh button of my browser, then I get an "array to string" error on $content.
I don't understand what happens during the refresh... any idea ?
Also in the future I am looking to pass an array of tables instead of $data, is it possible ? (something like View::forge('profile/index', array('data' => $data, 'data2' => $data2));
If you want to pass data to the View on a forge, you pass an array. What is in that array, is entirely up to you.
A reload is nothing more then re-issuing the request (either a GET or a POST). Your application is not aware it is a reload, there is no way for your client to let the application know.
So it must be something in your code that triggers this. Is there something that may cause a different path through the code is taken on a second request? For example the existence of session data?
found ! I was using a session variable called 'currentLang' and this was conflicting because it is probably a reserved variable or something like this. So my session was losing information and that was the source of my problem.
Thanks Harro, your comment helped me to understand this !
In the core, in both Session and View, data is stored in data containers, shielded from the outside, and in the case of the View class, only extracted in the context of a closure.