Welcome Guest, Not a member yet? Register   Sign In
Help creating pages from DB
#1

[eluser]bondjp[/eluser]
Hi, i have the following problem:

I want to create dynamic pages like this: mysite.com/usertype/username
usertype and username are fields in the DB.

In my view i can extract the username like this:
Code:
<?php $usern=$row->username;
        $url_title = url_title($usern);?>
                        
    <?php echo anchor ($url_title,$usern);?>

I want to add a usertype to the link and create the page. Right now it says page not found(as it should say) and the url is like: mysite.com/username

Can some one shed some light on how i can do it?
Thanks.
#2

[eluser]kgill[/eluser]
read the userguide section on URI Routing, CI URL's use the following:

yoursite.com/controller_name/function_to_call/params_to_pass/

if you want it to be something other than that you need to specifically tell it how it should be handled.
#3

[eluser]bondjp[/eluser]
[quote author="kgill" date="1266282505"]read the userguide section on URI Routing, CI URL's use the following:

yoursite.com/controller_name/function_to_call/params_to_pass/

if you want it to be something other than that you need to specifically tell it how it should be handled.[/quote]

Hmm, i understand what you're saying with "controller_name/function_to_call/params_to_pass/".
My case is a bit different because i want to use data from the db to build the url.
Let me explain:

mysite.com/toyota/prius

toyota and prius are data that i extract from my db. So i'm not using any function or controller in my url.

Can someone tell me how to do it or point me in the right direction?
Thanks.
#4

[eluser]123wesweat[/eluser]
like kgill said look into http://ellislab.com/codeigniter/user-gui...uting.html

$route['toyota/prius'] = "get_car/toyota/prius";




Theme © iAndrew 2016 - Forum software by © MyBB