Thread: Making a CMS
View Single Post
  #1 (permalink)  
Old 06-21-2008, 09:31 AM
Juul Juul is offline
Junior Member
 
Join Date: Jun 2008
Posts: 8
Default Making a CMS

Hi,

I'll make a CMS in PHP and I thought it could be saving me a lot of work to make it in ZF.

I don't really now how I should start on this as I never worked with ZF and I don't really understand how it's working. (I don't know every term (like for example a view helper and so one...) but I started making a directory structure and I don't know if this is the best structure for my CMS.

My CMS must have this features:
- Modular system
- Multiple themes (with different view files so the layout can be changed totally and not only with an other css file for example)

This is what I have now for the structure:
Code:
./application
        ./layouts
        ./modules
                ./module
                        ./controllers
                        ./models
                        ./views
./library
        ./Zend
./public
        ./images
        ./scripts
        ./styles
        ./index.php
Is this scruture good and does someone have any suggestions for me so I can make it better?

And this is my bootstrap:
[PHP]<?php
// Show every error
error_reporting(E_ALL | E_STRICT);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);

// Add the zend library to the include path
set_include_path('../library' . PATH_SEPARATOR . get_include_path());

// Auto load every class we need
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

// Load config
require_once 'config.php';
$config = new Zend_Config($config);
Zend_Registry::set('config', $config);

// Set up layout
$layout = Zend_Layout::startMvc(array(
'layout' => 'default',
'layoutPath' => '../application/layouts',
'contentKey' => 'content',
));

// DB connection
try {
$db = new Zend_Db_Adapter_Pdo_Mysql($config->database->params->toArray());
$db->getConnection();
Zend_Registry::set('dbConnection', $db);
} catch (Zend_Db_Adapter_Exception $e) {
echo 'Unexpected error!';
exit;
} catch (Zend_Exception $e) {
echo 'Unexpected error!';
exit;
}

// Error controller
$errorHandler = new Zend_Controller_Plugin_ErrorHandler();
$errorHandler->setErrorHandler(array('controller' => 'Error', 'action' => 'Error', 'module' => 'cms'));

// Set up front controller class
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$frontController->addModuleDirectory('../application/modules');
$frontController->setDefaultModule('index');
$frontController->registerPlugin( $errorHandler , 100 );
$frontController->setParam('noErrorHandler', true);
$frontController->dispatch();

// Quit page
$db->closeConnection();[/PHP]

Is this a good bootstrap?

Last edited by Juul; 06-21-2008 at 09:34 AM.
Reply With Quote