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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.