Jump to content

Correct way to implement a CMS


Superian

Recommended Posts

I am building an custom Content Management System, and I am not sure of the correct file structure that a CMS should have. Maybe you all could give me some ideas that I can benefit from. Below is an idea of the file structure that I am using.

 

<dir> blog

        index.php

<dir> images

<dir> style

 

Every file has an index.php in it, but the index.php is included inside of page.php. Blog is being pulled from the database.

The URL looks something like the following: http://localhost/page.php?content=blog

 

page.php

<?php
define('PAGE_FILE', true);
require_once("include_fns.php");

if (isset($content) && $content == $_REQUEST['content']) {
  include("$content/index.php");
} else {
  header("Location: index.php");
}
?>

 

index.php inside of the blog <DIR>

<?php
<?php
session_start();
if (!defined('PAGE_FILE')) {
  header("Location: http://localhost/index.php");
  exit;
}
?>

 

Any ideas on how I could improve my file structure because there are a lot of pages that I am going to implement.

 

 

Link to comment
https://forums.phpfreaks.com/topic/106208-correct-way-to-implement-a-cms/
Share on other sites

most search engines handle these quite well now days, but for some of the older ones it might be an idea to add a mod rewrite

 

My mod_rewrite is not working! What am I doing wrong?

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)/?$ /page.php?content=$1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.