• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.