如何“创建新页面”在PHP中工作?

Page creating in PHP: I'm trying to learn how to make a cms but I couldn't understand something. For example in Wordpress when you click "create a new page" button what is happening at the backside? For example now I don't have any page.

I want to create these pages dynamically:

  1. Home
  2. About
  3. Contact

After I want to add this pages in my menu. What is the best way to do that?

Questions:

  1. Should I create a new php file to do this or just get data from my database which belongs to each page?

  2. How I add these pages in my menu dynamically ?

  3. What is htaccess? I couldn't understand that exactly it does relating the the processes of the files.

There are tutorials on internet but they always show how to get articles from database. When I have another item (for example a slider) I need a real page.

Can somebody suggest me a simple tutorial, or provide a clear explanation which explains the logic simply.

I have created something similar. This is how I did it (may not be the best way but it is certainly the easiest).

  1. Create a template file and insert tags (!Title!, [[Title]], etc) where you want the new pages data to be inserted.
  2. When creating a new page, read the contents of the template and replace the tags with the data submitted (I used titles, desc, h1, etc but this can also be achieved through a simple content function)
  3. The user selects/creates the directory using mkdir()
  4. All this is then stored in DB ready for the user to navigate to.
  5. You can then use the DB entries to build a navigation menu