Welcome Guest, Not a member yet? Register   Sign In
Question about super class
#1

[eluser]shinokada[/eluser]
In the system/libraries/Controller.php, it says the following.

/* CodeIgniter Application Controller Class
*
* This class object is the super class that every library in
* CodeIgniter will be assigned to.

Q1. Does it mean I don't need to load it, if a class is super class?
Q2. If I extend Controller in applications/libraries/MY_Controller.php, will it be automatically loaded?


Thanks in advance.
#2

[eluser]jedd[/eluser]
Hi shinokada and welcome to the CI forums,

[quote author="shinokada" date="1253992378"]
Q1. Does it mean I don't need to load it, if a class is super class?
[/quote]

Yes, you don't need to explicitly load it anywhere (ignoring the effect of the parent and extends constructs).

Quote:Q2. If I extend Controller in applications/libraries/MY_Controller.php, will it be automatically loaded?

MY_Controller - assuming you keep the MY_ prefix as defined in your config - will be looked-for, and loaded automagically. Your Controllers will then need to extend and call MY_Controller as their parent, though, of course.




Theme © iAndrew 2016 - Forum software by © MyBB