Welcome Guest, Not a member yet? Register   Sign In
Creating pages for new users
#1

Hey there,

I'm currently working on an user management system, for which I want to generate (?) user profile pages; something like this for every registered user: mydomain.com/user/%username%

I'm quite new to CI and (web) development in general and I have simply no idea what kind of functionality I'd need for something like this, so I'd be able to google it.

I assume I don't want to create an actual php file for each user (automatically when the user saves the profile), rather maybe creating a template page and inserting user informations into it - right?

I'd be grateful if someone could point me in the right direction.
Reply
#2

(This post was last modified: 01-21-2021, 01:41 PM by iRedds.)

In your routes config file, you must define the relationship between the URI part and the controller, method and data being passed.

Look in the documentation depending on the version of the framework.

user/(:any) - Controller - method - data
Reply
#3

Complementing the answer above. After defining the route, the controller must get the username and query the user information from the database and display it on its page. You do not need to create one page per user. Just a template that is populated with the current user's data.
Reply
#4

Thank you both for your input - it makes sense now.
Reply
#5

I would also tack on the user id to the user name to make sure there are no duplicates.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(01-22-2021, 06:25 AM)InsiteFX Wrote: I would also tack on the user id to the user name to make sure there are no duplicates.

Usernames should be unique anyway, so that shouldn't be necessary.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB