error using $vars C.I 1.6 |
[eluser]vicman[/eluser]
Hi, i updated mi site, but now i can't use the param "$vars" in my views. Quote:A PHP Error was encountered What i do?
[eluser]Pascal Kriete[/eluser]
What is $vars? Where is it coming from? Some code would be nice.
[eluser]vicman[/eluser]
I work with PHP 4.4xx, and not work me!! i had that undo the update and back to CI 1.5.4
[eluser]tonanbarbarian[/eluser]
vicman please provide an example of the controller calling the view and the view code so we can determine what the problem is it is most likely there is a conflict because vars might be a reserved word now in CI 1.6 [edit] correction "vars" IS a reserved word in CI 1.6 Quick Reference See the reserved function names on the right never use the reserved function names for a function, method or variable as it may have strange results
[eluser]stevepaperjam[/eluser]
I had the same problem when I upgraded to 1.6, some of the stuff in my views was referred to via $vars. All I did was change... Code: $vars['thing'] Code: $thing
[eluser]vicman[/eluser]
example Controller Code: $data['body'] = $this->load->view('admin/historia/listhistoria', $data2, true); view In the view i send more than one parameters. Code: <div id="dv_tratamiento" style="width:100%; <? if ($vars['show'] === 'Normal') { ?>height:288px; overflow:auto; min-height:50px; max-height:288px;<? } ?>">
[eluser]Pascal Kriete[/eluser]
You don't need to use $vars, all of the values in the array are turned into variables. So if I have $data['show'] = "woot", and I pass this into the view, I can access it with $show. Also, you don't need to to pass the variables again when loading a subview, they're available to this view automatically. So your example becomes: Code: <div id="dv_tratamiento" style="width:100%; <? if ($show === 'Normal') { ?>height:288px; overflow:auto; min-height:50px; max-height:288px;<? } ?>"> |
Welcome Guest, Not a member yet? Register Sign In |