Welcome Guest, Not a member yet? Register   Sign In
Strange behaviour with views and arguments
#1

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.
Reply
#2

(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.
Keep calm.
Reply
#3

The view variables are cached.

See the CI_Loader
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

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

(This post was last modified: 06-13-2016, 06:08 AM by spjonez.)

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB