
August 11th, 2008, 07:57 PM
|
|
Registered User
|
|
Join Date: Aug 2008
Posts: 4
Time spent in forums: 45 m 36 sec
Reputation Power: 0
|
|
|
Basic Code Layout for CMS Backend
Hi, I just registered at codewalkers but I've been a long time member of the devshed forums.. I saw that the 2 forums are related and as it seems codewalkers is completely php oriented whilst devshed goes for everyone.
Anyway, about this thread, I am re-doing the basic layout for each backend page of my CMS, the example is for content.php which handles the management of content pages (news articles, regular pages, blogs.. etc).
The CMS is to be 100% object oriented and should be simple to read so that people can be encouraged to make their own modifications and/or plugins.
Please tell me what you think of the following piece of code and if you were to foresee any kind of problems in using it.. the classes and functions are pretty much self explanatory.
PHP Code:
<?php
require('global.php');
class Content {
// Handle POST queries
function POST() {
switch($_POST['a']) { // check the 'action' variable
case 'doinsert':
// do stuff
break;
case 'doupdate':
// do stuff
break;
}
}
// Handle GET queries
function GET() {
switch($_GET['a']) { // check the 'action' variable
case 'insert':
Page::Output('Content->Insert');
break;
case 'update':
Page::Output('Content->Update');
break;
}
}
// Default page output
function Output() {
Template::Output('Content_List');
}
// Output create new content
function Insert() {
Template::Output('Content_Insert');
}
// Output update existing content
function Update() {
Template::setVar('id',$_GET['id']);
Template::Output('Content_Update');
}
?>
Thank you
|