backend and frontend setup for Yii

Currently I have 2 install setups of Yii for both my backend and frontend. But while working on this it gets abit confusing and I was wondering if this done in the right way. Below is an example how my folder structure is setup.

- backend
  - assets
  - css
  - images
  - js
  - protected
         - components
         - config
                main.php

         - controllers
         - data
         - extensions
         - models
         - modules
         - runtime
         - views
              - layouts
              - site

         .htaccess
         yiic
         yiic.php

  - themes
  - upload
  index.php
  .htaccess


frontend

  - assets
  - css
  - images
  - protected
         - commands
         - components
         - config
                main.php

         - controllers
         - data
         - extensions
         - models
         - modules
         - runtime
         - views
              - layouts
              - site

         .htaccess
         yiic
         yiic.php

  - themes
  index.php
  .htaccess

Can anyway tell me of this is a good way. Or is it a stupid way. What is the normal way to do this. I have looked into documentation but it's all uncomplete or not specific. What I want is the most common way to setup a backend and frontend structure for Yii.


My opinion, the best way is do not break encapsulation and use setup like the following:

  • http://www.yiiframework.com/wiki/63/organize-directories-for-applications-with-front-end-and-back-end-using-webapplicationend-behavior/
  • http://habrahabr.ru/post/117457/ (russian)
  • In this case:

  • you will be able to store all controllers and views in one place
  • on module structure(when you will use it) that will not break their encapsulation and you will be able easy to share their between your sites

  • 您还可以查看Yii项目站点YiiProject目录结构的目录结构或者下载Clevertech的yii Boilerplate并查看它们的文件夹结构。这里是链接YiiBoilerplate

    链接地址: http://www.djcxy.com/p/78182.html

    上一篇: 后端和前端数据库

    下一篇: Yii的后端和前端设置