分离前端和后端 [英] codeigniter separating frontend and backend

查看:106
本文介绍了分离前端和后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读过这些网页:


http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with- CodeIgniter

单独的管理员和在代码中的前面(看看Madmartigan的回答)

Separate Admin and Front in codeigniter (look at answer by Madmartigan)

他们都是好办法,但我不确定如果这是我正在寻找。

their both good approaches but I'm not sure if that is what I'm looking for.

我想分离前端和后端我想像这样的布局:(view image )
我要将大型Web应用程序转换为CI,并保持一切尽可能有组织,我认为这个文件夹布局将是最好的方法,但自从一个新手CI,你会考虑这种布局吗?我已经尝试这个布局已经作为一个测试,我会遇到问题,因为目录名为后端或前端,所以当我会输入say:

I want to separate the front-end from the back-end I was thinking of a layout like this: (view image) I am about to convert large web applications to CI and to keep everything as organized as possible i figured this folder layout would be the best approach but since im a newbie to CI would you consider this layout? I have attempted this layout already as a test and I would run into problems since the directory is named back-end or front-end so when I would type say:

http://example.com/backend/mycontroller/mymethod I would reach a 404 page. 

推荐答案

上周我正在调查一个小项目(最后我用Kohana 2.3.4,但不介意:P)

I was looking into this last week, for a small project I was setting up (in the end I went with Kohana 2.3.4, but never mind :P)

CodeIgniter最好的文件系统是:

The best file system I came up with for CodeIgniter is this:

/ application
/ - /admin
/ - - /config
/ - - /controllers
/ - - /models
/ - - /views
/ - /public
/ - - /config
/ - - /controllers
/ - - /models
/ - - /views
/ core
/ - /all the core stuff
/ public_html
/ - /admin
/ - - index.php
/ - index.php

这里的问题是没有代码共享两者之间,所以你不能重复使用任何东西 - 如果你确定的(可能不适合大型应用程序),这应该可以做你想要的。

The problem here is there's no code-sharing going on between the two, so you can't re-use any stuff - if you're OK with that (probably not good for a large application), this should probably do what you want.

如果切换到Kohana是一个选项,给我一个喊,我会post我的结构,这是类似的,但有一个额外的水平,前端和后端可以共享代码,同时仍然使用其特定代码作为优先级。对于比小应用程序更大的任何东西,它是更好的)。

If switching to Kohana is an option, give me a shout and I'll post my structure for that - it's similar to this, but has an extra level where I the front-end and back-end can share code, while still using their specific code as a priority. It's much nicer for anything bigger than a small application :)

这篇关于分离前端和后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆