Welcome Guest, Not a member yet? Register   Sign In
unexpected dynamic data behavior when loading views
#5

"This method produces the same result as using the second parameter of the $this->load->view() method above." - this phrase reveals that the behavior is intended.

You expect that variable context of different views to be isolated, this is a good expectation. With an addition of "global_vars()" method for serving serving special-purpose variables (intended to be global/cached) this would have been the cleanest implementation. The Twig parser for example supports global variables if they are explicitly registered as such.

But..., the current behavior is not accidental, it is intended, and it is specially implemented using the CI_Loader::_ci_cached_vars property.

A behavior change/improvement here will be a compatibility break. It will probably affect my code, because I am using the Phil Sturgeon's Template library which also reads _ci_cached_vars property.

Your idea in principle is correct, I think it should be considered for CodeIgniter 4.
Reply


Messages In This Thread
RE: unexpected dynamic data behavior when loading views - by ivantcholakov - 04-15-2016, 02:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB