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

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.

(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

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.

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

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 )

(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.

Theme © iAndrew 2016 - Forum software by © MyBB