malina Posted December 1, 2008 Share Posted December 1, 2008 First of all Id like to say hi! since I am new to this forum. I'd like to get some recommendations/suggestion on best practices when building a dynamic website. In general I am developing a website where users can create their accounts. As soon as they activate it they can create their simple websites as user.domain.com. This is done using a dns wildcard plus some simple mod_rewrite redirections. To be more specific when a person visits user's site - user.domain.com - he or she is redirected to the site root - domain.com - where the index.php file catches the "user" part and displays user specific content (based on the "user" part) from a database. I have already been told that some caching have to be involved in the process of delivering the content to the user's browser. Users will have the ability to edit their sites (content in the database) and it's looks as well. The "content" part stored in the db is simply plain text and links to media files stored on the server, but there will be some serious css formatting and jquery visual effects/ js user interface facelifting. My question is: Is there any more sophisticated/faster and "valid" approach to resolve displaying user's pages to the audience? What would be the best way to handle css in this case? Storing css values in the database, using user specific css files? Users' sites will be generated from some default php template file which will be customized be modyfing css values and attributes. If You could suggest some online tutorials/ articles on this matter I would be grateful, since I don't know where to look for such an abstract topics. I could also use any tips and comments. Chris Link to comment https://forums.phpfreaks.com/topic/135058-best-approach-to-build-a-website-like-this/ Share on other sites More sharing options...
awpti Posted December 2, 2008 Share Posted December 2, 2008 Custom CSS files (username+random chars? or name it the same as the subdomain). The less you have in your database, the more performance you'll be able to squeeze out of it. The file system is always faster than a database (for, hopefully, obvious reasons) for storing relatively flat content. Your idea will work fine - it's how WordPressMU works (though less than elegantly). I've never seen online articles discussing this specifically, but look into a framework like CodeIgniter, Kohana or Cake to reduce development time and give you more time to sit back and consider viable options. Link to comment https://forums.phpfreaks.com/topic/135058-best-approach-to-build-a-website-like-this/#findComment-703546 Share on other sites More sharing options...
malina Posted December 2, 2008 Author Share Posted December 2, 2008 Custom CSS files (username+random chars? or name it the same as the subdomain). Account name (username) seems to be the right choice to me than since it is unique and linking css file won't engage database querying. The less you have in your database, the more performance you'll be able to squeeze out of it. The file system is always faster than a database (for, hopefully, obvious reasons) for storing relatively flat content. I agree. Thanks for pointing this out. I guess caching all those little (and non essential) db queries into files would be a good idea? I've never seen online articles discussing this specifically, but look into a framework like CodeIgniter, Kohana or Cake to reduce development time and give you more time to sit back and consider viable options. I am a bit afraid it would increase development time as I would have to get into one of those seriously (and I am not a php programmer). What do You think? Link to comment https://forums.phpfreaks.com/topic/135058-best-approach-to-build-a-website-like-this/#findComment-703784 Share on other sites More sharing options...
malina Posted December 2, 2008 Author Share Posted December 2, 2008 And one more little question: Is the algorithm below most efficient? Any better ideas? A. userA enters "www.domain.com" in the address bar -> check IF the subdomain is set (this includes dealing with the "www") -> IF NOT show him the main website with ads etc. let him see it, register, or login -> IF he logs in redirect to "userA.domain.com" with some kind of $_SESSION variable indicating he is logged in -> show him admin controls B. some other user enters "userA.domain.com" in the address bar -> show him userA's content; if $_SESSION variable is not set -> he does not see any administration tools/links Link to comment https://forums.phpfreaks.com/topic/135058-best-approach-to-build-a-website-like-this/#findComment-703806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.