Hi,
On Tue, Nov 23, 2010 at 11:57 PM, Jerome Renard jerome.ren...@gmail.com wrote:
As you said, the very first thing to do is to get familiar with Zeta
Components.
But with regards to what you have already done with Midgard, I believe
it will be a piece of cake.
Yep. I'll do some experiments today, and start pitching the idea to
the rest of our community.
* Geolocation library: https://github.com/bergie/midgardmvc_helper_location
This one is really interesting.
Another that might fit into Zeta quite easily is the Forms library.
This also is a completely standalone package, though it has a helper
for autogenerating forms from Midgard2 schemas (which could be adapted
to Zeta database schemas too).
https://github.com/midgardproject/midgardmvc_helper_forms
http://www.qaiku.com/go/6nbc/
As these two have quite minimal external dependencies I guess they
would be the first potential contributions from us to Zeta. The other
pieces are a bit more interconnected, and some overlap with existing
Zeta stuff so probably it is best to work together first on the
simpler stuff and tackle those later.
If possible I would prefer getting only one MVC component in order to
avoid confusion
for users if they want to do MVC. This does not meant yours is bad at
all, it just means
that being able to compare differences with MVCTools [3] and your MVC
framework would
be ideal first. And then we could see how to manage with this, maybe
we could integrate
some parts of your system in MVCTools. This needs to be debated actually.
Agreed that multiple MVC implementations in Zeta doesn't sound like a
good idea. Actually, probably having any full MVC implementation there
doesn't make sense. Therefore the term MVCTools is a good choice, as
the project can provide common building blocks for different MVC/CMS
projects to implement :-)
On a quick look at MVCTools, Midgard MVC is conceptually, and in some
places also API-wise quite similar.
Here's the basic description of how our MVC works:
https://github.com/midgardproject/midgardmvc_core/blob/master/documentation/index.markdown
Some quick points:
* Routes work very similarly, though we use different URL mapping
syntax based on URI templates[1]. So this could be just another
MvcRoute implementation
* We also rely on a Request object, and use it for request isolation
(everything related to a request is kept in that object as we have to
support multiple requests within one PHP run)
* In Midgard MVC we have full subrequest support, so in your template
you can for example make a subrequest to display five latest news
items
* In our case Routing Information would also contain the matched
variables from the URL (so URL /news/meego/2 matched to a route
/news/{$category}/{$number} would provide array('category' = 'meego',
'number' = 2)
* Our routes are also used for generating URLs when applications want
to redirect or display links
* We do not require controllers to extend any baseclass as the
component interface is quite trivial
* In our case controller actions are named with pattern HTTP
verb_action name, so you can define separate action methods for
handling GET and POST (for example) for a route
* Controller's results in our case are just stored to a data array
in the controller, so actions don't return anything. In cases of
errors they're supposed to throw exceptions
* We have a concept similar to MvcTools Filters called Injectors. At
the moment you have only two of these: ones called after request has
been parsed but before controller is called, and ones after controller
has been run but before we go to templating
* Views is probably the area where our approaches diverge the most. In
Midgard the whole thing is run by template composition, where route
only provides aliasing information on how to handle element inclusion
in the template. We use TAL as the default templating system
Anyway welcome to the Zeta Components community :)
Thanks! The Midgard project has always been quite isolated from the
rest of the PHP world (though I guess many other similar projects are
also quite insular). Hopefully this collaboration can change things
:-)
Jérôme Renard
/Henri
1: http://tools.ietf.org/html/draft-gregorio-uritemplate-04
--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/
Skype: henribergius
Jabber: henri.berg...@gmail.com
Microblog: http://www.qaiku.com/home/bergie/