Welcome Guest, Not a member yet? Register   Sign In
User subfolders like Twitter ?
#1

[eluser]codecode[/eluser]
Is there a way to create user subfolders automatically when you create an account like Twitter does (i.e. mywebsite.com/usersubflolder)with code igniter?
I'm working on social media app. that requires that and I don't know how to go about it.

Thank you!
#2

[eluser]Dam1an[/eluser]
Are you actually on about creating folders, or somethink like discussed here (there's several more threads about this already, this one was top of the pile)
#3

[eluser]codecode[/eluser]
That was a quick response. Thank you much, I'll take a look a the link you've provided.
#4

[eluser]slowgary[/eluser]
You wouldn't actually create subfolders. Sites like Twitter are database driven, so they would be crazy to create a million subfolders. Check out the CI user guide, it talks about URI structure in the controller section:
Code:
http://ellislab.com/codeigniter/user-guide/general/controllers.html

Also, you'll probably want to have a look at the routes section:
Code:
http://ellislab.com/codeigniter/user-guide/general/routing.html
#5

[eluser]codecode[/eluser]
Now, may I ask if there is already some pre-built code that will do just that, create a user account and also create a user (virtual)subfolder?
T
#6

[eluser]slowgary[/eluser]
You may ask.

I doubt there would be anything to do this automatically, as everyone's needs would be different when it comes to user accounts.

Also, you're not really 'creating' a user's virtual subfolder. Instead, you're accessing their account dynamically by using the first URI segment.

So basically you access something like http://www.domain.com/jimmydean, and in your default controller you use the first URI segment to retrieve the user's profile from the database.
#7

[eluser]darkbrian[/eluser]
you could also just use .htaccess to do the same thing.
#8

[eluser]codecode[/eluser]
How can I use the .htaccess to do this?
#9

[eluser]slowgary[/eluser]
You really can't. An .htaccess file allows you to set server directives, so you could use it to restrict files or folders, but you'd need to add each user to it, either manually or through a script. You'd also need to create and maintain passwords for those users. All that would do is allow them access to a particular folder, it wouldn't create folders for each user.

What exactly are you trying to do? What will your app do? How much have you done so far? What will a user see when they visit www.yourdomain.com/username?

The more information you can provide about what you're trying to accomplish, the easier (and thus, more likely) it will be for someone to prescribe a solution.

Also, the codeigniter user guide is VERY thorough, it provides you with enough information to do what you're trying to do. So if you're asking for help with things that are already in the user guide, you're really just wasting time.
#10

[eluser]Phil Sturgeon[/eluser]
@slowgary: You are massively confusing this one. codecode is simply looking for a non-intrusive method to route all example.com/username requests to something like example.com/users/profile/username. This CAN be done with routes or by extending the router.

Please search around using Google or the search bar for this as I have seen it answered so many times I made a bloody blog post about another method.




Theme © iAndrew 2016 - Forum software by © MyBB