Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Controller's Functions not recognized?
#1

[eluser]Unknown[/eluser]
I've run into a problem that I've seen before, the symptoms i've seen when using a reserved name like 'view' or whatever, however this time i am not using a reserved name.

I can view my controller's index no problem: /user or /user/, it redirects to my "User" controller and calls index().

However when I try to view /user/products or /user/products/ it produces a CI 404 page.

I checked to see my routing and .htaccess were working properly, /news/add works just fine, as well as /news/add/, no problems, here's an apache log output (note the request dosent show the redirection, but works properly)

Quote:***.141.92.*** - - [08/Nov/2007:00:04:27 -0600] "GET /news/add HTTP/1.1" 200 4731 "-" "Opera/9.21 (Windows NT 5.1; U; en)"
***.141.92.*** - - [08/Nov/2007:00:04:42 -0600] "GET /user/ HTTP/1.1" 200 4479 "-" "Opera/9.21 (Windows NT 5.1; U; en)"
***.141.92.*** - - [08/Nov/2007:00:04:49 -0600] "GET /user/products/ HTTP/1.1" 404 551 "-" "Opera/9.21 (Windows NT 5.1; U; en)"
***.141.92.** - - [08/Nov/2007:00:12:38 -0600] "GET /user/products/ HTTP/1.1" 404 551 "-" "Opera/9.21 (Windows NT 5.1; U; en)"

Log Output:

Quote:DEBUG - 2007-11-08 04:08:13 --> Config Class Initialized
DEBUG - 2007-11-08 04:08:13 --> Hooks Class Initialized
ERROR - 2007-11-08 04:08:13 --> 404 Page Not Found -->

Below is my .htaccess:

Quote:<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /re-write-not-availiable.php
</IfModule>

Below is my "User" Controller:

Code:
&lt;?php
class User extends Controller
{
    function User()
        {
            parent::Controller();
        $this->load->helper('form');    
        $this->load->library('validation');
        $this->load->library('email');    
        $this->load->library('lanified');
        }
    
    function index()
    {
        $this->lanified->build_page( "Welcome", "Testing");
    }
    
    function products()
    {
        $this->lanified->build_page( "Welcome", "Products");
    }
}
?&gt;

Note: The Lanified library works fine, the build_page function drives every other working page on the site.

The code execution when calling /user/products isn't even getting inside the function!

You can test for yourself:

http://www.lanified.com/user/
http://www.lanified.com/user/products

(Note: Products is a test function I've thrown inside to test my problem, the original problem was on my registration function which i've removed currently for testing purposes.)

Update

I added in the following code as a test of the routing:
Code:
function _remap($module)
    {
        echo $module;
    }

Update 2

It is not a routes issue (although i think it's a routing issue) My routes.php is just your standard default/scaffolding, nothing custom.

This makes /user/ produce 'index' and /user/products/ still 404's

Update 3

It seems functions over 4 letters in length are the culprit in THIS CONTROLLER ONLY.

/user/a
/user/aa
/user/aaa
/user/aaaa

all will work (assuming my _remap() provides for it or the functions exist) but:

/user/aaaaa

will not.

Starting to lose hair over this!
#2

[eluser]Unknown[/eluser]
Solved, I feel like a dork. CI was having issues with PATH_INFO mode (auto), REQUEST_URI solved this.
#3

[eluser]dreamer111[/eluser]
hmm. I know it's an old post.

I'm having the same problem however changing $config['uri_protocol'].

Is there anything else that could potentially cause this issue?




Theme © iAndrew 2016 - Forum software by © MyBB