Welcome Guest, Not a member yet? Register   Sign In
Name Collisions with autoload (best guess)
#1

[eluser]micha8l[/eluser]
Here's part of my directory structure:
Code:
application/
    models/
        _administrator/
            article_category_model.php
        article_category_model.php
    controllers/
        _administrator/
        article.php
    article.php

I $autoload['article_category_model'] using config file.

In my "application/controllers/_administrator/article" controller I have this code:
Code:
class Article extends Administrator_controller
{
    public function __construct()
    {
        parent::__construct();
    }

    public function issue()
    {
        $this->load->model('_administrator/article_category_model');

        // HERE'S WHERE IT DOESN'T WORK -- I JUST GET BLANK SCREEN
        $this->article_category_model->create_issue();
    }
}

It seems that when I call article_category_model's create issue method, CI will search for the method in "application/models/article_category_model.php" instead of "application/models/_administrator/article_category_model.php".

Please help, how can I fix this, 3 hours I've been at this!
#2

[eluser]Aken[/eluser]
Blank screen = error. Turn error reporting on in your php.ini file / locally in index.php, and see what the error says. Debug from there.

You cannot declare the same class name in PHP, even if they're in different files in different directories. Your model class names must be different.
#3

[eluser]micha8l[/eluser]
[quote author="Aken" date="1344499369"]Blank screen = error. Turn error reporting on in your php.ini file / locally in index.php, and see what the error says. Debug from there.

You cannot declare the same class name in PHP, even if they're in different files in different directories. Your model class names must be different.[/quote]

Thanks for correcting me on that Aken, blank screen is indeed error. However error reporting is on, as I've tested it -- this is something else.

However I did not know I could not declare same class name, I'm newbie and my cracks are showing Big Grin

And so I look into namespaces http://www.php.net/manual/en/language.na...ionale.php





Theme © iAndrew 2016 - Forum software by © MyBB