Hi - I've been trying to develop a simple site which allows users to make lists of things (I'm teaching myself php, mysql, etc along the way). The site has user management/login/etc functionality, and I've developed a page where the lists can be created.
I just feel like the way I'm generating pages based on users is inelegant, and I'm wondering how more sophisticated developers do it. Right now a user can sign-up and that will give them an account page (e.g. www.website.com/Daniel/index.php). They can then generate lists, each of which is a new page (e.g. www.website.com/Daniel/List1.php).
I've been using php 'fopen' and 'fwrite' functions to generate a page like 'Daniel/List1.php'. I can see where this would get really difficult to do though, as I continue adding features to the site. It also generates a lot of pages, which would all have to be edited if I made a change to that page, so I assume something more modular might be possible. How would a site like facebook do this (e.g. in the early days, when it was a simpler php/sql site)?
It's been a little tricky to find an answer to this online, since I don't really know what I'm asking... would appreciate pointers in the right direction. Thanks!
Creating a site with User-generated pages
Page 1 of 15 Replies - 2488 Views - Last Post: 12 June 2012 - 10:03 AM
Replies To: Creating a site with User-generated pages
#2
Re: Creating a site with User-generated pages
Posted 12 June 2012 - 03:00 AM
the question is, how free are the user in generating their pages? is it only content => CMS, can they use their own design => predefined themes to self-made CSS, or can they do everything => get them their own server account.
#3
Re: Creating a site with User-generated pages
Posted 12 June 2012 - 08:57 AM
It's content (think twitter) - a user can create an account, then start adding data (right now entirely text). The site is about making lists, but imagine if it were a twitter clone.
#4
Re: Creating a site with User-generated pages
Posted 12 June 2012 - 09:57 AM
I guess another way to put it, if I want to have:
site.com/daniel.php
site.com/daniel/list1.php
site.com/daniel/list2.php
Do I really need to have separate pages created on my server for each of these URLs, or can I link to site.com/daniel/list2.php and a script generate a page view on the fly (without having to make an actual page)?
site.com/daniel.php
site.com/daniel/list1.php
site.com/daniel/list2.php
Do I really need to have separate pages created on my server for each of these URLs, or can I link to site.com/daniel/list2.php and a script generate a page view on the fly (without having to make an actual page)?
#5
Re: Creating a site with User-generated pages
Posted 12 June 2012 - 10:03 AM
of course you can (with a little help from mod_rewrite).
#6
Re: Creating a site with User-generated pages
Posted 12 June 2012 - 10:03 AM
Think less about individual pages and more about data in a database and a single page that retrieves that data based on parameters.
For instance:
site.com/list.php?user=daniel&list=2
So you would only have 1 PHP file to display all the lists, you would just pass the user ID and list number to display then query the database with that information.
For instance:
site.com/list.php?user=daniel&list=2
So you would only have 1 PHP file to display all the lists, you would just pass the user ID and list number to display then query the database with that information.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|