[eluser]ddutra[/eluser]
Bronco, hi.
Lets say you have a domain called www_broncoblog_com, and you want the user to access stuff from user profiles, right, but you want the URL to contain the User's name?
I would simply create a controller named user, and a function named profile($login), so profile receives login as a parameter and look on the database, serving the profile info, like name, address, and werever you need.
www_broncoblog_com/user/profile/bronco -> This will serve bronco's profile
www_broncoblog_com/user/profile/ddutra -> This will serve ddutra's profile
Code:
Controller {
function profile($login) {
query database;
serve data loading view;
}
}
Notice that in this sample you have 3 levels after the baseURL, one being the controller name, the other being the function name and the rest are the parameters.
It would help more if you said what exactly is "entry-from-database". If you want to display human readeble data on the url (like LOGIN, Client Name, Suppliers name, Article Name) but only have the code to work it on links i would suggest a redirect to the same function, since as far as i know you cant rewrite the URL with CI.
Lets say "entry-from-database" is login, but you only have the login ID's to build the links, i would do something like this:
Your link: www_broncoblog_com/user/profile/1 -> This is bronco profile, but due to google indexing or user experience, i dont want the URL on the browser to be displaying a code "1", i want it to show the user login name, makes more sense... well no problem:
Code:
controller {
function profile($login) {
//First lets check if we are receiving a ID or a login name
if (isset && is_numeric($login)) {
//Login is set and is numeric, this will require a redirct using CI resources
//First lets grab the login name from the db, i will assumo you know how to do that
$login_name = $queryDB;
redirect(base_url().'/user/profile/'.$login_name, 'location', 301);
exit;
}
else {
//The url is showing a Login Name, so now we can serve the data, and maybe hope google indexes it right :P
$this->Load view.
}
}
}
All links have been modified due to this forum rules, wich are a lame way of dealing with spammers IMO.
Hope i got your question right, and hope my anwser is right too. I am also new to CI.
Thanks and best of luck.