CodeIgniter Forums
Naming of Controllers - any names not allowed? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: Naming of Controllers - any names not allowed? (/showthread.php?tid=73498)



Naming of Controllers - any names not allowed? - webmachine - 04-30-2019

I am building an application, and wanted to have one of the controllers called Resources. No matter what I try, my app will not allow me to use this name - when I try to use a link `<a href="<?php echo base_url(); ?>resources">`, I get an "Object Not Found" error instead of the page. With any of my other controllers, I have no issues. Is Resources a restricted word for controllers?


RE: Naming of Controllers - any names not allowed? - php_rocs - 04-30-2019

@webmachine,

Did you follow the CI naming conventions for the Controller name and class? Is the permissions for the controller file correct?

Here is the documented list of reserved names https://www.codeigniter.com/user_guide/general/reserved_names.html#reserved-names


RE: Naming of Controllers - any names not allowed? - souicp - 04-30-2019

do you want use <?php echo base_url('resources'); ?>


RE: Naming of Controllers - any names not allowed? - Wouter60 - 05-01-2019

Autoload the url helper and write hyperlinks to controllers(/methods) like this:
PHP Code:
<?= anchor('resources','Go to Resources');?>

Also check if the Resources.php file has a Class named "Resources".