Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're not familiar with the Model-View-Controller pattern, reading up on it might be prudent. MVC is frequently the right starting place for high-level design of web applications.</p> <p>Also, a CMS is a big enough project you should consider using a PHP framework like CodeIgniter, Symfony, Zend, etc. to make your life easier. It removes a lot of the drudge work and common tasks.</p> <p><strong>Dynamic Page Creation and Display</strong></p> <p>I think you want to split it into two things: the text content (basically what you put in the forms) and the HTML templating surrounding that content.</p> <p>When you make a page or blog post, you would want to store the actual content (what you type into the creation form) in a database of some sort (not necessarily an RDBMS, but if you're trying to build MySQL skills it's a reasonable choice).</p> <p>Then you would use a separate function to bind that content into an HTML template and present it to the user when they load a given page.</p> <p><strong>URL Routing</strong></p> <p>To get nicer-looking URLs you can use something like apache's mod_rewrite. You can use that to convert a URL like this:</p> <p><code>posts/how-to-make-a-cms</code></p> <p>to this:</p> <p><code>posts.php?title=how-to-make-a-cms</code></p> <p>Then you can have posts.php read from GET as normal. How you choose to do the conversion is pretty open-ended.</p> <p>To avoid getting really complicated rewrites, people often just structure everything to go to a central routing script which figures out what class and method to call and what arguments to pass it. So it would rewrite the URL above to:</p> <p><code>main.php?a=posts/how-to-make-a-cms</code></p> <p>Then main.php would parse out the segments of that argument from GET and figure out where to send them. Like it might take <code>posts/show/how-to-make-a-cms</code> and do something like:</p> <pre><code>$o = new Posts(); $o-&gt;show("how-to-make-a-cms"); </code></pre> <p>If you do it that way, I think you can avoid mod_rewrite entirely as long as you're willing to accept only slightly pretty URLs, like this:</p> <p><code>mysite.com/main.php?/posts/show/how-to-make-a-cms</code></p> <p>I haven't done this type of thing before (because the frameworks do it so beautifully already), so I might be missing some minor details.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload