Building a website backend with Code Igniter
What is the best (or most appropriate in a general situation) structure for building a website administration section with Code Igniter? I have heard of several structure ideas, but they all stem from the two bas开发者_高级运维ic structures.
- Have two applications, administration and application
- Have one application which encompasses both sections.
What are the pro's and con's of each method?
Are there any other structures that you can suggest?When examining these idea's one must take into account the possibility of a shared resources.
E.g. shared log in accounts, shared database, shared designs etc.
Single Application:
Pros:
- Shared Authentication
- Shared Configuration
- Shared Model Code
- View Level Integration ([Edit This] links in main application)
Cons:
- Low Site Seperation (Can run into issues with setting your site to maintenance mode or bugs causing admin to blow up or visa versa)
- Shared Authentication (Both a pro&con, if your auth is compromised, invader has access to admin).
Multiple Application
Pros:
- Site Separation, No taint from admin in live site (visa versa)
- Clearly defined application roles & can be optimized for their tasks.
- For example, you can optimize a db for reads and set your front end on that, and then set up a different db the backend works on and sync to it. (Only really makes a difference in high load websites, but still a conisdderation).
- You can host the admin site @ a seperate domain for extra security or subdomain with a seperate SSL Certificate, etc...
Cons:
- Code Duplication
- Configuration Duplication
- No tie-ins to main site (or limited).
Overview
It really depends on what you're doing. I'd say for any high trafficked site or any site with sensitive customer data (like credit card details etc) that the site separation of separate applications is invaluable. It allows for a great deal of security considerations above & beyond your average site. Also this allows you to greater optimize each application for their purpose for raw speed.
On medium / low traffic sites, I'd say the simplest approach is always the best (KISS). It'll help you keep your site up to date & moving forward faster. This is essential for sites building up & starting out. Less development time is always a great thing.
That's just a personal opinion though, it's really up to you, it comes down to what's most important to you & your business.
精彩评论