backend and frontend setup for Yii

backend, frontend, yii

Solution

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

Problem

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.

Original source