Welcome Guest, Not a member yet? Register   Sign In
Can't extend CI_Controller
#9

[eluser]Lukas1[/eluser]
[quote author="InsiteFX" date="1302032125"]Your MY_Controller needs to be in application/core not application/controllers !

If the CI Library is in system/core then the extended Libraries go into application/core

If the CI Library is in system/libraries the the extended Libraries go into application/libraries

InsiteFX[/quote]
I really appreciate, that you are trying to help me, thank you, but do you even read, what I am writing here all the time? I repeated at least twice, that MY_Controller IS in application/core. And that it should be there and not in libraries folder, since I am using CI 2.0 and haven't changed anything with folder structure. Let me now quote my previous post here:
[quote author="Lukas1" date="1302004787"]
So I want to do this:
in application/core/my_controller.php
Code:
public class MY_Controller extends CI_Controller {
    protected function get_html_header() {
      return '<head><title>Title of this page</title><'head>';
    }
[/quote]
The very post, you have replied to.
I am not sure, if my english is incomprehensible, or what the problem is, since you haven't understood what my problem is from the very beginning. I am sorry for pointing this out, but it really disappointed me... Don't get me wrong, I really appreciate your willingnes to help me.

Anyway I already found the solution for my problem. I've digged into the CI code and found, that CI searches for a file called MY_Controller.php (my file was called my_controller.php and then I tried MY_controller.php, but with no success->everything because of C in the word controller was lowercase, when CI expected it to be uppercase). So it was my mistake, I haven't read the documentation carefully.

Notice for everyone:
If anyone has a problem with extending core classes, like for example Controller, don't forget that the filename must have the first three letters uppercase->MY_Controller.php, not my_controller.php, or MY_controller.php.


Messages In This Thread
Can't extend CI_Controller - by El Forum - 04-04-2011, 10:17 AM
Can't extend CI_Controller - by El Forum - 04-04-2011, 10:21 AM
Can't extend CI_Controller - by El Forum - 04-04-2011, 10:23 AM
Can't extend CI_Controller - by El Forum - 04-04-2011, 01:37 PM
Can't extend CI_Controller - by El Forum - 04-04-2011, 02:52 PM
Can't extend CI_Controller - by El Forum - 04-04-2011, 03:47 PM
Can't extend CI_Controller - by El Forum - 04-05-2011, 12:59 AM
Can't extend CI_Controller - by El Forum - 04-05-2011, 08:35 AM
Can't extend CI_Controller - by El Forum - 04-05-2011, 09:22 AM
Can't extend CI_Controller - by El Forum - 04-05-2011, 11:15 AM
Can't extend CI_Controller - by El Forum - 04-05-2011, 12:22 PM
Can't extend CI_Controller - by El Forum - 04-10-2011, 05:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB