I'开发者_运维技巧m about to start on a small, static website project: no database or CMS required. Basically, a brochure website.
I used the CodeIgniter framework recently to develop a full-blown web application, and I'm wondering if it appropriate to also use CI for smaller, simpler sites.
Typically for a static brochure site I would write regular PHP pages with a few includes thrown in to save on repetition (i.e. HTML with a sprinking of PHP), but this time around I'm wondering if my new friend CodeIgniter might be able to streamline the development process.
Is it sensible to consider a framework for such a simple project, or is it overkill? I'm worried that I might be the proverbial carpenter whose only tool is a hammer, and sees every problem as a nail!
I think almost never, the needs change and come more with time... so it is better to have a good base using a framework to wait the future needs. but if your project will not have a long live time and your needs are reaaally simples then i think is not necesary use a framework.
I personally would never develop a site outside of a framework for anything more than a single page brocure-ware site. I work so much faster inside the framework.
I'm a Python/Django developer but here's my take.
I've done some small non-framework sites with PHP and I don't know how PHP frameworks compare to DJango, but if they're anything alike the fact remains that I'm far more proficient developing within a framework than to code something from scratch by hand.
It helps me stay organized if nothing more than giving me the VC of the MVC. Django provides me with a lot of built-in tools, like form handling, that make my life much easier even for small sites.
I'm going to presume PHP frameworks provide similar things, maybe not though.
You also can't anticipate how the site will grow over time. It's easier to maintain something built in a framework, and if you ever need to extend the site in the future it's nice to have some structure behind it.
Since I tend to either inherit bespoke frameworks, or write my own, I would peg it at about 3 pages: if it's more, then setting up a framework is worth it. And if it needs a DB, then odds are good you'll end up with more than 3 pages, anyway. :-)
I recommend Rapyd, a "minimalistic and rapid PHP framework".
How long is a piece of string?
I use CodeIgniter (specifically PyroCMS) for crappy 5 page brochure-ware but that is purely to let clients admin their own pages easily with a WYSIWYG.
Any client will say "Wow, news, contact form and I can get me some of that Twitter too?!" so I just dump it in there to save everyone time.
If you are developing from scratch there is no point if the content is static. Something like CodeIgniter helps with DB interaction, Form validation and the breaking down of multiple pages into logical chunks i.e Controller classes and methods.
If you have no db-content, don't handle forms and don't have many pages then there is litterally no point adding the overhead.
That said, try my Twiny framework for literally the smallest MVC framework around.
If you don't need a database, CMS and is just a simple static HTML/css/PHP page, I don't think you can go wrong creating a site without a framework. Plus, if you have been using frameworks for a long time, you can have a break and do "code for code" and have a feel what it's like to code from scratch :)
Site is never small if the client is there who may want to ask you to add more functionality at any time :)
For a simple site like that. why even use a framework why not use something like concrete5. Overkill? definitely. but hey it is easy and requires almost no coding so upkeep is a breeze.
The site would be up and running in less than an hour and it makes you look good in the eyes of your customer and that can't hurt.!
I don't think any project is too small for a framework, I think some frameworks are too big for small projects. Everyone hopes their website will grow. So no matter how small the site is now, growth will be easier to manage if you start with a framework.
The only case when framework would be an overkill is with a throw-away scripts, such as when you need to quickly automate something that you won't need to do again ever. For anything that will enter execution cycle more then few times framework is a probably would be better.
If it requires under several hours of work - then it is small. Anyway if you plan to devote more than "several hours" - definately use a framework AND a control revision system.
It depends. If you're positive this is all the site you're working on will ever be, or migrating when future needs arise, then I can't see why there would a reason for using a framework, unless you feel more comfortable working with one.
As a personal example, I recently worked on a semi-static website, for which I put together a minimal framework which worked as a caching preprocessor for static html, inserting common html-elements into preset places. This allowed for some dynamic content, yet still using only static html for content.
I'd say you're answer lies within a formula consisting of future development needs, your own working preference, and performance.
精彩评论