[] 自个儿动手写CMS

[] 自己动手写CMS
   
<?php/* * 简易的cms插件,可供借鉴或者扩展 *  * ---- 流程: *   定义内容; *   分类与组织内容 * 	 存储内容 *   操作控制内容 *  * 定义内容: * 	 制定目标; * 	 确定需要的内容类型 *   目标用户定位 *   确定目标用户需要何种技术 *  * 分类与组织内容: *   按内容所属的逻辑层级关系来划分 *   按内容的种类来划分,比如video/text/audio等等 *  * 存储内容: *   关系数据库 *   xml *   文本文件 *  * 操作控制内容: *   对操作进行颗粒度分离 *   提供足够的元数据信息 *   内容的描述 *   外部展示(web/xml/html),以及定义ui */require_once 'db.php';abstract class simplecms {}class simplecms_model_contenttype {		/**	 * @var firephphelper	 */	protected $_firephphelper = null;		/**	 * @var coredb	 */	protected $_dbo = null;		protected $_tablename = 'content_types';	protected $_primarykey = 'ctype_id';		protected $_namefield = 'ctype_name';	protected $_descriptionfield = 'ctype_description';	protected $_createdfield = 'created_at';	protected $_updatedfield = 'updated_at';		/**	 * 构造函数	 */	function __construct(){		$this->_firephphelper = firephphelper::getinstance();	}		/**	 * 查找内容类型列表	 * 	 * @var mixed $cond	 * @var int|array $limit	 * @var string $fields	 * 	 * @return array	 */	function getall($cond=null,$limit=null,$fields='*'){}			/**	 * 更新内容类型记录,参数中必须带着主键字段	 * 	 * @var array $row	 * 	 * @return boolean	 */	function update(array $row){			if (isset($row[$this->_primarykey])){			$row[$this->_updatedfield] = current_timestamp;			$sql = coredbsqlhelper::getupdatesql($this->_dbo,$row,$this->_primarykey,$this->_tablename);					return $this->_dbo->execute($sql,$row,true);		}		return false ;	}		/**	 * 添加一个内容类型,返回插入的主键值	 * 	 * @var string $name 类型名	 * @var string $description 描述	 * @var array $extra 额外字段属性	 * 	 * @return int	 * @throws sqlqueryexception	 */	function add($name,$description,array $extra=null){		$row = array(			$this->_namefield => $name ,			$this->_descriptionfield => $description ,			$this->_createdfield => current_timestamp ,		);		if ($extra){			$row = array_merge($row,$extra);		}		$sql = coredbsqlhelper::getinsertsql($row,$this->_tablename);		if ($this->_dbo->execute($sql,$row,true))			return $this->_dbo->lastinsertid();		return false;	}		/**	 * 类型主键是否存在	 * 	 	 * @var string $primarykey	 * @return boolean	 */	function existsbyprimarykey($primarykey){		return $this->_dbo->getdbutils()->findcount(			$this->_tablename,array($this->_primarykey=>(int) $primarykey),$this->_primarykey);	}		/**	 * 类型名称是否存在	 * 	 * @var string $name	 * @return boolean	 */	function existsbyname($name){		return $this->_dbo->getdbutils()->findcount(			$this->_tablename,array($this->_namefield=>$name),$this->_primarykey);	}}
 
未完,待续...