tags:

views:

132

answers:

3

I have a new PHP project coming up and I want to use a framework. I'm a little intimidated because I don't yet understand the workflow of using a framework, and what I'll need to do differently to get my work done. I'm also concerned about painting myself into a corner if a framework can't do what we need -- for instance in another project, we had reports that were pdfs generating from complex aggregating queries. Could the framework handle everything I would need it to, or would I have to break out of it at some point, or write a module for it? I'm not aware of a PHP framework that has a 'Crystal Reports' module ;)

In the past my site design has been basically that each page is mostly a form that submits to the database, and displays some results from the database afterwards. It's basically a user-friendly database interface; there's not much in the way of plain pages that don't originate from database data. There is a basic menu that lets the user navigate the site.

The project coming up is an employee handbook/manual project. The person authoring the handbook will select pre-existing chapter titles ( think categories ) and paragraphs that go under that title, and write their own. The employee will be able to read the handbook assembled for their position, take a quiz ( which comes from the paragraphs ), and print the manual, which is a pdf of the chapter/paragraph data. All data is stored in the database. Is there a framework that is more geared for this type of application, or would any good one do?

( Looking at the MVC paradigm, the model here would be the database structure, the view is the code that generate the pages, and the controller is code that parses input, puts it in the database, and decides what to show the user as a result? )

+5  A: 

I think using a lightweight framework would get rid of most of your worries, as they are simpler, and easy to get them to do whatever you want. I would recommend CodeIgniter

It's an MVC framework, and your guess how MVC works is close to correct. The Model handles ALL interactions with the database, you basic CRUD operations. The view is indeed what generates the pages. The controller is there to handle communication between the models and the views.

So in your site: the view is a form, when it is submitted, the controller catches this data, and passes it to the model, usually via a create() or update() function. The controller can then call a different view for the submission successful page.

GSto
+1 for Codeigniter. It's fast, light and well made IMO.
Ben S
Thanks, GSto! Would CodeIgniter handle the PDF part, or do I "break out" for that?
+1 for the grean'n'simple MVC explanation.
DaNieL
Tutorial on handling PDFs in CodeIgniter: http://www.christophermonnat.com/2008/08/generating-pdf-files-using-codeigniter/
GSto
We're using R I don't see how it's integrated into the framework. Is it? Does the framework handle *everything*, or is it like using another library?
..a framework is just a **big** library..
DaNieL
DaNieL - could one say that a framework is a big library that could conceivably handle most tasks you need for a web application?
Yes, that's exactly what a framework is: a big collection of libraries, melted toghether, to handle the mosts needs a developer should have. If you'll need something really particular, you'll have to write you class by your own.
DaNieL
A: 

You can go for cake PHP, It's a small project and it will be quick. I wouldn't use Zend or any other heavy framework for that kind of project.

Try to choose one with a good documentation (Short an precise)

I don't think php frameworks are the best for small mvc projects. I'd rather use RoR, Django or Play.

mnml
A: 

Normally you start to use a framework because you are going to use it in many projects, and you adopt the framework because it helps you in writing less code. You don't normally use a framework because you can then report you are using it.

There is difference between a framework, and a CMS system (some of the replies seem to make confusion between the two). A framework is a collection of libraries that help developing and glue together the different components of a software project; you normally speak of framework talking of Zend, .NET, Synfony, etc. It is also true that the term is sometimes used as a buzzword, but when you ask for a PHP framework the word makes me immediately think of Zend.

kiamlaluno
Hey, I am interested in writing less code. I suspect that I have been writing my own framework as a side effect of developing these sites.If you had to do the project I am tasked with, what framework, libraries, or CMSes would you use?
If I would write something that just saves the data in the database, and get htem back from there, then I would use Drupal; that is because I am already using it, and it allows you to have a web site almost ready without the need to write much code. Zend is good, but to have the same features present in Drupal (support for rules, taxonomy, an administration interface ready to be used, etc) you should write a lot of code.
kiamlaluno
I am sorry; I was not clear in my answer. I just meant that what to use would depend from your necessities, and what you plan to do in your future projects. Reading it now, it sounds like I was a little harsh when that was not meant.
kiamlaluno
"I just meant that what to use would depend from your necessities, and what you plan to do in your future projects." Well, this doesn't tell me anything that I didn't already know. I hope I had explained the requirements well enough in the question. There are a lot of frameworks out there, and I don't feel I know enough about frameworks to really compare and judge them. So I was hoping I could get advice from someone who knew a framework that would work for this project. I do want a framework that I will use far into the future, so I want to avoid starting with one, switching, etc.
p.s: drupal is a cms, not a frameork ;)
DaNieL
@DaNieL: I know, but he asked also for a CMS, in the comment.
kiamlaluno