架空のCMS
2007年12月17日
先の記事で考察したNucleusの長所・短所を鑑みて考えた、架空のCMSの基本部分は、次のとおり。
Nucleusのconfig.phpとglobalfunctions.phpに相当する部分だけ、コードを書いてみた。
config.php:
jeans/libs/core.php:
コアの構造は、こんな感じ。core.phpは、バージョンアップがあっても、変更されない仕様。
Nucleusのconfig.phpとglobalfunctions.phpに相当する部分だけ、コードを書いてみた。
config.php:
<?php
// main jeans directory
define('DIR_JEANS', dirname(__FILE__) . '/jeans/');
// path to media dir
define('DIR_MEDIA', dirname(__FILE__) . '/media/');
// extra skin files for imported skins
define('DIR_SKINS', dirname(__FILE__) . '/skins/');
// SQLite connection information
define('SQLITE_DBFILE', DIR_JEANS . 'sqlite/.dbsqlite');
// these dirs are normally sub dirs of the nucleus dir, but
// you can redefine them if you wish
define('DIR_PLUGINS', DIR_JEANS . 'plugins/' );
define('DIR_LANG', DIR_JEANS . 'language/');
define('DIR_LIBS', DIR_JEANS . 'libs/' );
// Hash Salt
define('HASH_SALT','');
// include core
require(DIR_LIBS.'core.php');jeans/libs/core.php:
<?php
// Exit when config.php is not used.
if (!defined('DIR_JEANS')) exit('DIR_JEANS not defined!');
// Include two basic classes
require_once(dirname(__FILE__).'/SQLITE.php');
require_once(dirname(__FILE__).'/MANAGER.php');
// Initialize everything in following method.
MANAGER::init();
// There is only one global function.
function __autoload($className) {
MANAGER::__autoload($className);
}コアの構造は、こんな感じ。core.phpは、バージョンアップがあっても、変更されない仕様。