Super object is Pages or Controller.php? |
Hi. I just started reading the tutorial and it says:
Quote:Create a file at application/controllers/pages.php. The pages class is extending the CI_Controller class. This means that the new pages class can access the methods and variables defined in the CI_Controller class (system/core/Controller.php). Here $this is controller.php or pages.php? I understand that $this is the Controller.php and I will refer to it as $this when using its methods in pages.php. I just want to double check because pages.php and Controller.php are both controllers.
since pages extends the CI_Controller, it's also a controller which inherits its parents methods. So, $this is the controller when in CI_Controller, and also any other controller that extends CI_Controller.
[quote]So, $this is the controller when in CI_Controller, and also any other controller that extends CI_Controller.[quote]
Im talking about this particular case thats why I quoted tutorial, not a general definition of $this. So when I say $this it means both Pages.php and Controler.php? If I want to use a Controller.php's method within Pages.php I will refer to Controller.php as $this, but you are saying that whenever I say $this I will be referring to both Controller.php and Pages.php - that doesnt make sense because $this can only be referred to one class.
|
Welcome Guest, Not a member yet? Register Sign In |