rbz/codeigniter

此包最新版本(2.0.0)没有可用的许可证信息。

与HMVC、Doctrine ORM和Twig集成的CodeIgniter应用程序,用于动态CMS(空白可构建CMS)项目

安装: 57

依赖: 0

建议: 0

安全: 0

星星: 2

关注者: 3

分支: 1

开放问题: 0

语言:JavaScript

类型:项目

2.0.0 2016-04-30 16:19 UTC

This package is auto-updated.

Last update: 2024-09-16 18:45:19 UTC


README

使用基于laravel的Webcore单一平台,请访问 https://github.com/dandisy/webcore 代替

DynamicCMS

与HMVC、Twig和Doctrine ORM集成的CodeIgniter应用程序

具有动态路由、动态控制器和从数据库获取的动态视图功能

这是rbz/codeigniter项目,用于开发空白可构建CMS,适用于博客、门户网站、电子商务等。使用单一平台。

注意
If you want only CodeIgniter integrated with HMVC, Twig and Doctrine,
but not the codes part of DynamicCMS, you can clone version 1.1.0
or clone this version and remove unwanted codes by your self.

also you can edit composer.json to exclude unwanted packages (Twig or Doctrine).

But for excluded HMVC you must manually delete the file in core and third_party folder,
because this part included manually, not using composer.
  1. 准备

    如果您不熟悉,只需阅读CodeIgniter文档即可开始基于CI的网站。

  2. 安装

    • Git

      将此git项目克隆到您的网站根目录

        git clone https://github.com/dandisy/dynamicCMS.git
      

      进入文件夹并运行

        composer install
      
    • Composer

      运行

        composer create-project rbz/codeigniter:dev-master your-project-folder-name
      

      或者直接运行(以获取最新稳定版本)

        composer create-project rbz/codeigniter your-project-folder-name
      

    然后在浏览器中运行

     your-hostname/folder-name or your-project-folder-name/public
    
  3. 如何使用Doctrine ORM

    • 从实体(代码优先)生成模式

      • 在models/entities中创建实体,例如

          <?php
          /**
           * @Entity @Table(name="products")
           **/
          class Product
          {
              /** @Id @Column(type="integer") @GeneratedValue **/
              protected $id;
              
              /** @Column(type="string") **/
              protected $name;
          
              public function getId()
              {
                  return $this->id;
              }
          
              public function getName()
              {
                  return $this->name;
              }
          
              public function setName($name)
              {
                  $this->name = $name;
              }
          }
        
      • 在终端中

          ./vendor/bin/doctrine orm:schema-tool:create
        
    • 从数据库(数据库优先)生成实体

      • 在终端中

        首先,生成映射注解

          ./vendor/bin/doctrine orm:convert-mapping --from-database annotation models/entities
        

        然后,生成实体

          ./vendor/bin/doctrine orm:generate-entities --generate-annotations=true --generate-methods=true models/entities
        

        最后,确保生成的实体类与现有类(例如控制器类或模型类)不相同,如果相同,则需要手动更改

          - class name
          - annotation refered
          - file name        
        
  4. Twig实现

    配置为在每个模块中读取以.twig为文件扩展名的视图,如果您想使Twig读取其他目录或文件扩展名,则必须在Twig.php库中更改配置。

  5. CodeIgniter实现

    出于安全原因,index.php已移动到public文件夹,而CodeIgniter系统文件在网站根目录之外。您必须将网站根目录设置为这个public目录。

作者:dandi@redbuzz.co.id