![]() |
sth confused me - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: sth confused me (/showthread.php?tid=23066) |
sth confused me - El Forum - 09-29-2009 [eluser]vantao[/eluser] I am a newbie to codeigniter!however, something about CI_URI confused me,let's describe it: Code: class CI_URI { it's a summary of CI_URI,only include constructor method. what screwed me is this statement: Quote:$this->config =& load_class('Config');as above there has no member $config in class CI_URI,why this statement use it?????? sth confused me - El Forum - 09-29-2009 [eluser]wiredesignz[/eluser] Code: /* line 60 */ Oops sth confused me - El Forum - 09-29-2009 [eluser]rogierb[/eluser] Although it might have been *better* programming to initialize $config, this is now simply done by using the member in the constructor. So basically one can use any member even if it is not defined; Using $this->some_member_that_has_not_been_defined = "Some_value"; is allowed. sth confused me - El Forum - 09-29-2009 [eluser]vantao[/eluser] [quote author="wiredesignz" date="1254248765"] Code: /* line 60 */ Oops[/quote] what do u mean?? detail,please!!! sth confused me - El Forum - 09-29-2009 [eluser]wiredesignz[/eluser] PHP allows variable assignment without definition. RTFM. sth confused me - El Forum - 09-29-2009 [eluser]vantao[/eluser] [quote author="rogierb" date="1254248781"]Although it might have been *better* programming to initialize $config, this is now simply done by using the member in the constructor. So basically one can use any member even if it is not defined; Using $this->some_member_that_has_not_been_defined = "Some_value"; is allowed.[/quote] tks for your explanation!!! maybe this kind of usage is not friendly to newbie sth confused me - El Forum - 09-29-2009 [eluser]wiredesignz[/eluser] This is a PHP convention, it has nothing to do with CodeIgniter. sth confused me - El Forum - 09-29-2009 [eluser]vantao[/eluser] [quote author="wiredesignz" date="1254249273"]PHP allows variable assignment without definition. RTFM.[/quote] tks sth confused me - El Forum - 09-29-2009 [eluser]BrianDHall[/eluser] I appreciate your desire to dig into the code and understand it, but for those new (to PHP, MVC, OOP, or just CI) kind of the point of CI is you don't have to dig down in there. I've gone through two commercial projects so far without ever even seeing that bit of code, and I'm still not really any the better for having read and spent the time to understand it ![]() If the magic works, let it ![]() sth confused me - El Forum - 09-30-2009 [eluser]vantao[/eluser] [quote author="BrianDHall" date="1254255619"]I appreciate your desire to dig into the code and understand it, but for those new (to PHP, MVC, OOP, or just CI) kind of the point of CI is you don't have to dig down in there. I've gone through two commercial projects so far without ever even seeing that bit of code, and I'm still not really any the better for having read and spent the time to understand it ![]() If the magic works, let it ![]() tks , your advice is great |