I have been asked to create a website and wanted to design it so that the user may add new blog posts to a news feed. I’ve tried this and successfully created a very simple blogging feature which adds/reads entries in a sql database.
However I want to dynamically create new webpages for each blog entry that is added by the user. How would I go about this? I am new to Php/Sql and so I am unsure of where to start. Any pointers in the right direction would be greatly appreciated.
As for an example of what im after, see: http://kingslandprimaryschool.co.uk/
Thanks
The solution is to hire an army of employees, who manually create hundreds of scripts. A lot of work, but what else can you do? Nah, just kidding.
The trick is not to create a new file for every blog page, you just have to change the routing. Start by creating a blogging system which works through consistent URL’s, such as
blog.php?p=home. When you’ve finished, create a .htaccess file which routes certain requests to that page. For example, if you would want an URL likemy.site/hometo loadblog.php?p=homeyou would need the following .htaccess script:This would first check whether a file exists at the requested URL. If it does, it shows that file. Otherwise,
blog.php?p=myPathis opened. The[QSA]tag after the redirect means that everything after the question mark is passed on to the script you redirect to, so if you would go tomy.site/home?day=wednesdaythe pageblog.php?p=home&day=wednesdaywould be loaded.If you need more help, feel free to ask any question. Alternatively, you can just Google “htaccess mod_rewrite” or “PHP pretty url” for more information. Hope this was of help!