-5

i'm a beginner in php but want to expand my knowledge. so i want to create a cms from scratch.

i already have an idea how to create a post. by inserting data to database

and populate the html file with the data(post) that came from the database

example this is my website

domainname.com/index.php --- and this is the address of my homepage

on my homepage, i want to show some preview of my each post.

something like this, enter image description here

and if the user of the website click the post. it will go to another page

domainname.com/postname.php

and with the data like this

enter image description here

so my question is how do the CMS create the file for every post. the idea in my mind is creating the html file dynamically using php and naming the file with the name of the post. but is it a good practice? or am i doing it right?

Community
  • 1
  • 1
Audrey
  • 161
  • 1
  • 2
  • 9
  • Why not use an existing one? Wordpress, Laravel, etc. If you're eager to learn a new language, have a look at Django CMS. – Jan Mar 19 '16 at 09:06
  • because i want to expand my knowledge sir – Audrey Mar 19 '16 at 09:07
  • But you want to reinvent the wheel - it's really a lot more complicated than you think. If you want to start low, maybe have a look at `Slim`. – Jan Mar 19 '16 at 09:09

1 Answers1

1

While generating static files (whenever the admin interface is used to make a change) will work, it isn't a typical approach for a CMS.

Usually they will apply the front controller pattern (in which each request for a content page, despite having different URLs, is funneled through the same PHP program, something that is often achived with the Apache mod_rewrite module) and generate the requested page on demand.

Community
  • 1
  • 1
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335