Welcome Guest, Not a member yet? Register   Sign In
Problem with routes
#1

[eluser]Unknown[/eluser]
Hey there,

I'm quite new to CodeIgniter and I just took over a nearly complete project and whilst it's been a pleasure thus far, I've become quite annoyed with one part.

I'm trying to create more "custom sites", I want to create a site that's actually it's own module, not an SQL content site.

My problem goes a little bit like this (and by a little bit, I mean exactly like this):

I have 2 modules in: ~/application/modules/

Let's call them amazing and dumb.

So I have ~/application/modules/amazing (and the subdirectories "controllers", "models" and "views"). And then I have ~/application/modules/dumb (which is literally [for testing purposes] "cp -r amazing/ dumb/" - so it was the exact same thing, I then changed all the references within it so it's actually calling dumb and not amazing).

I then have these routes in ~/application/config/routes.php

Code:
$route["amazing/stuff"] = "amazing/index";
$route["dumb"] = "dumb/index";

When I go to http://example.com/amazing/stuff - the site loads (with the appropriate content) - everything is perfect.

I then go to http://example.com/dumb - the site 404's.

I'm flabbergasted.

I have ran

Code:
find . -name "*.php" | xargs grep "amazing"

and it only turns up the actual "amazing" module and the routes.php but nothing else. Therefore it's not mentioned in any other file where I'd also have to add "dumb".

Naturally, I gave up and did some Google-fu, I was disgracefully beaten and therefore I turn to you. There is a reward in the form of a beautiful paint drawing for the person who can help me fix this!

Regards,
Gunni
#2

[eluser]Tpojka[/eluser]
Try with
Code:
$route["dumb"] = "dumb";

Because index method is autoloaded if not pointed something else.
#3

[eluser]Unknown[/eluser]
[quote author="Tpojka" date="1384348288"]Try with
Code:
$route["dumb"] = "dumb";

Because index method is autoloaded if not pointed something else.[/quote]

Thanks, unfortunately it didn't work, it's still 404'ing.

Regards,
Gunni
#4

[eluser]Tpojka[/eluser]
Remove that line from routs.php and try again.
Do you have dumb.php in application/controllers?
It should be like:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dumb extends CI_Controller {//notice capital for Dumb

public function __construct(){//include construct method too
  parent::__construct();
}

public function index()
{
  
}
}




Theme © iAndrew 2016 - Forum software by © MyBB