CodeIgniter Forums
Strange behaviour with views and arguments - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: Strange behaviour with views and arguments (/thread-65423.html)



Strange behaviour with views and arguments - GiftZwergrapper - 06-09-2016

Hey guys,

I've got a very strange behaviour with views and arguments.

So I am loading multiple views in 1 page and I give the first multiple arguments like 'image_src' and 'image_alt' and the strange thing is now, when I do not give the next view (which is structured like the first) any arguments, the arguments from the first view are taken.
Just as if CodeIgniter is caching them or something.

I checked my entire code, I used a var_dump to check if the arguments are set, they are not.
Then I'm loading the view via CodeIgniter and then they are there.

Is this a bug in CodeIgniter or a feature? Is there a workaround?

Unfortunately I am using CodeIgniter 1.7.2 and my colleagues and I can't upgrade, beacuse there was to much changed in the core functionality of CodeIgniter.
And if we are going to upgrade, everything's gonna explode..

Thanks in Advance.


RE: Strange behaviour with views and arguments - arma7x - 06-10-2016

(06-09-2016, 11:39 PM)GiftZwergrapper Wrote: And if we are going to upgrade, everything's gonna explode..
Thanks in Advance.
You must upgrade, only version 3.x.x is currently supported.


RE: Strange behaviour with views and arguments - InsiteFX - 06-10-2016

The view variables are cached.

See the CI_Loader


RE: Strange behaviour with views and arguments - cartalot - 06-10-2016

well if you are using a template file, and calling other views - its a feature :-)


RE: Strange behaviour with views and arguments - ivantcholakov - 06-10-2016

This has been already discussed:

http://forum.codeigniter.com/thread-64965.html
http://forum.codeigniter.com/thread-64969.html


RE: Strange behaviour with views and arguments - spjonez - 06-13-2016

You should be able to overload _ci_load in MY_Loader as long as its public/protected to stop this from happening. You can in 3.0.6 I don't have a copy of 1.7.2 handy to look at the source. It's an odd bit of functionality especially if you're used to more traditional templating systems.