Welcome Guest, Not a member yet? Register   Sign In
How to use controller with the name starts with "public*", etc "publication"
#1

[eluser]cskevinwang[/eluser]
I have a controller named "publication". CI won't recongize it as a controller name. In fact, any name starts with "public" is not valid. Any idea how to solve this?
#2

[eluser]anis2505[/eluser]
It works fine for me.
#3

[eluser]Pert[/eluser]
Maybe if you copy part of your controller code here we can see if it's something else that breaks it. Name itself should be ok.
#4

[eluser]cskevinwang[/eluser]
Here is my controller code. It gives me a 404 error when I run it. It works fine if I only change the controller name to Pub or anythine else without "Public" prefixed.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Publication extends Member_Controller {

    function __construct()
    {
      parent::__construct();
    //  $this->load->model('publication_model');
    }
    function index()
    {
        $data['main_content']='publication/index';
        $data['title']='Publication';
        $this->load->view('layout/master', $data);  
    }
}
//end of publication.php
#5

[eluser]Pert[/eluser]
Have you tried switching CI logging to max for few calls and see what is written in log file?

Is controller file name correct? If you save a file it should be lower case just because some environments treat file names with lower and upper case names differently.
#6

[eluser]cskevinwang[/eluser]
Solved it. It's because I rewrote the .htaccess file RewriteCond $1 !^(index\.php|public|robots\.txt)
I used to put my css js files in public folder.
#7

[eluser]Pert[/eluser]
Happy days, things like these are usually, like you said, down to a really small configuration change in server somewhere.




Theme © iAndrew 2016 - Forum software by © MyBB