MY_Controller in ci2 |
[eluser]bobdobbs[/eluser]
Is there any relevant documentation for MY_Controller for the current version of CI ? Hi. I'm learning codeigniter, and I'm experimenting with a project using version 2.02, the latest available version. I wanted to figure out how to maniupulate multiple view, and pass data to them. The documentation keeps leading me back to this page: http://codeigniter.com/wiki/MY_Controller However, that page starts with the warning: Quote:Take care - these instructions are for CodeIgniter 1.7.x - the 2.x release sees MY_ class extenders relocated to app/core - see the relevant documentation for 2.x. I can't seem to find a similar document that has the same documentation, but for 2.x version of CI. Is there any updated documentation for doing the same thing, but for later version of CI?
[eluser]InsiteFX[/eluser]
Code: // MY_Controller - application/core/MY_Controller.php InsiteFX
[eluser]sehummel[/eluser]
So if I wanted to set $data in the Any_name base controller, how would I do that, and how would I access that data in the controllers that extend Any_name? $this->data? Could you provide a little bit of code for me to illustrate this (for CI 2.x). What I want to do is pass $data to a view, but define $data in the base controller. There's not much out there on this subject. Thanks.
[eluser]LuckyFella73[/eluser]
you can do something like that: Code: <?php And access it later on in your controllers: Code: $this->your_variable EDIT: Phil Sturgeon has more informations about setting up base controllers in his blog: http://philsturgeon.co.uk/news/2010/02/C...ing-it-DRY |
Welcome Guest, Not a member yet? Register Sign In |