user993683
user993683

Reputation:

Basic set up for wiki-type website

I want to create a website that has each of its pages stored on the server, but not as loads of individual html files. A user would also be able to create a page by simple entering the page text, a page title, then clicking submit. This would then add that page to the server, and the page would be easily indexable by search engines.

Should the pages be stored in a mySQL database? And if so, how would each page have a permanent link without doing something like: www.website.com/loadpage.php&p=8 I would prefer something like: www.website.com/user-submitted-page-title/

Obviously lots of websites do this, but I haven't been able to find any explanation.

Sorry if this is a bit of a rookie question, I really appreciate the help.

Upvotes: 0

Views: 311

Answers (4)

n00dle
n00dle

Reputation: 6053

It sounds like you want to build a "content management system" or CMS. These store the page content in a database (which could well be MySQL, but is not limited to it) then use a server-side language such as PHP to put the content onto a page. You can then do useful stuff like build a page template and only fill out the bits that change from page to page (so your header, menu and footer are all predefined and you fill in the main body of the page).

Here's a guide on writing a very basic CMS, although if you're new to PHP and just want to get something online, you could think about using an open source one such as Joomla or Wordpress. If you want some middle-ground, there are frameworks such as Zend and CodeIgniter, which will do some of the work for you, but I haven't had any experience of those, so couldn't offer any advice.

You also need url-rewriting to get the kind of URL's you want - there's a good question here that covers it: dynamic URL rewriting .htaccess

Upvotes: 2

Katti
Katti

Reputation: 2121

You can create your own CMS with this or use the most famous CMS available like Wordpress, Drupal, Joomla or FromCMS.

You can use some php or python scripts from below to create your own url.

How to automatically generate a page after user fills a form via PHP? http://lifehacker.com/5335216/make-your-own-url-shortening-service
How to let PHP to create subdomain automatically for each user? http://www.hongkiat.com/blog/how-to-create-url-shortener-with-your-domain/

Yes you can choose any of the sql servers to stored the data. The best one to choose is mysql (Open Source Database Management system)

Upvotes: 1

i-CONICA
i-CONICA

Reputation: 2379

What you've described is actually how almost every website on the net works. It's not an obscure thing, actually, it'd be ludicrous to have a website where the pages are stored as html files, unless it's only one or two pages...

Essentially, you have the portions of data stored in a table. Imagine pages table, it has cols *id, page_title, page_desc, page_content, page_created, page_author_id*, etc...

You'd then have a template file called page.php, which would be passed parameters like ?pID=14 or by title ?pTitle=my-cool-page-title and you'd match up to that page in the database, get the content from mysql_fetch_array, and echo those portions out into the html areas in your template file.

You'd then hide the page.php?pTitle=my-cool-page-title by using mod_write which is absolute voodoo, so don't worry if that blows your mind, it blows most people's minds until they're quite advanced. Search for "simple mod_rewrite rules" and you'll figure it out.

Things you need to research:

  • "Simple database driven website tutorials" or "php + mysql website tutorial" maybe.
  • htaccess and mod_rewrite
  • Escaping input from POST/GET when interacting with a database. <- important

Upvotes: 1

Bas Slagter
Bas Slagter

Reputation: 9929

You should take a look at user-friendly-urls. In most cases this involves an .htacess file which redirect each url to the index of your website. In there, you can parse the url and lookup the right page in your database for example.

Upvotes: 2

Related Questions