Jeff Davidson
Jeff Davidson

Reputation: 1929

Working with CodeIgniter routes?

I think this is a route issue but I'm not sure. I have a page with this URL:

siteurl.com/kowmanger/titles/titles/edit/$id

I'm trying to find out that when I'm on this page I load the titles page it says page not found so I need to tell it that the $id is just a paramter so I can use it to get the data of the title.

UPDATE :

So I decided to change my titles controller so that there's a edit and add function inside of the titles controller that way they dont' have separate controllers when they are in fact methods.

So now I have:

kansasoutalwwrestling.com/kowmanager/titles/titles - list of titles

kansasoutalwwrestling.com/kowmanager/titles/titles/add - addnew form

kansasoutalwwrestling.com/kowmanager/titles/titles/edit/$id - edit form

I don't have any routes set up so far for this. For some reason though I"m getting the same page for both of these page.

kansasoutalwwrestling.com/kowmanager/titles/titles/add - addnew form (right link url) kansasoutalwwrestling.com/kowmanager/titles/add - addnew form

I need a route so that it'll show the correct url if the add method is accessed.

Also I need to set up a route so that if the correct edit link is accessed it sees the id attached to the end of the url and it'll accept it so that I can do a my database query to get the title data.

UPDATE: So to reiterate I have a module(subfolder) called titles. Inside of the module I have a controller called titles and inside of that controller I have 3 functions called index(), add(), edit().

I tried using Chris's suggestion on the routes but its not routing correctly. Also wanted to mention I'm using wiredesignz modular separation framework if that matters.

Any additional ideas?

Upvotes: 0

Views: 214

Answers (2)

chris
chris

Reputation: 36957

Possible answer based on your post, not one hundred percent your entire structure but if i had to guess based off the post I would try this as my routes first..

$route['titles/titles/edit/(:any)'] = 'titles/titles/edit/$1';
$route['titles/titles/add'] = 'titles/titles/add';
$route['titles/titles'] = 'titles/titles';
$route['titles'] = 'titles/index';

Upvotes: 1

AchrafSoltani
AchrafSoltani

Reputation: 216

Are you using custom routing in your configuration files ?

The general routing protocol used by codeigniter is like this:

domain.com/controller/methode/param1/param2/param3

This being said, your url

siteurl.com/kowmanger/titles/titles/edit/$id

corresponds to something like this :

class Kownmanger extends CI_Controller
{
    public function titles($titles, $action, $id)
    {

    }
}

In case you are using sub-folders in your controllers folder, what I have just said will change, Could you please tell us what's your directory structure ?

Upvotes: 0

Related Questions