CodeIgniter Forums
Is "Directory" a reserved word? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Is "Directory" a reserved word? (/showthread.php?tid=12943)



Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]fesweb[/eluser]
I would like to create a controller named directory, but it refuses to work until I change the name to directory2.

In looking at the reserved words list for code igniter, I don't see a problem - and I can't find a similar list for php itself.

What am I missing?

Thanks.


Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]bastones[/eluser]
Can I see your code, specifically the Controller code? Not sure if anyone can do much without it.


Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]fesweb[/eluser]
Here it is.
http://foo.com/directory/ does not work (blank page):
Code:
class Directory extends Controller {

    function Directory()
    {
        parent::Controller();
    }
    
    function index()
    {
        echo 'Hello';
    }
    
}
But http://foo.com/directory2/ does:
Code:
class Directory2 extends Controller {

    function Directory2()
    {
        parent::Controller();
    }
    
    function index()
    {
        echo 'Hello';
    }
    
}



Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]Colin Williams[/eluser]
It's reserved by PHP, not CI. Pretty sure it's used by the PHP dir() function

Code:
print_r(get_class_methods('Directory'));



Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]dcunited08[/eluser]
[url="http://us2.php.net/manual/en/class.dir.php"]PHP Man[/url]


Is "Directory" a reserved word? - El Forum - 11-05-2008

[eluser]fesweb[/eluser]
Thanks. I figured, but my searches weren't turning up anything...