|
Posted by Lόpher Cypher on 01/01/06 04:06
funky wrote:
> I see what you are getting at. I however do not understand how the
> array can be a model. Normally in MVC the model is what the view
> represents and it (the model) should not really know anything about the
> view (or the controller). The controller knows about the view and the
> model.
>
> In your example I would say that the array is more like a controller is
> it "controls" what the next view will be based upon a url parameter (i
> guess).
>
> I like the idea that you give pages ids. In fact I do that in some way
> as well. Instead of using urls, I use a class which converts ids to
> urls so that if i ever change a path I do have to do a grep over all my
> php files.
>
> Is this how you organise your php web pages?
>
Well, I'm working on an MVC-based library for creating template-driven
sites right now. There is an abstract Model, View, and Controller
classes. For templates, we have
TemplateController
/ \
/ \
v v
TemplateModel <-- TemplateView
In which TemplateModel is data about different pages in xml. The
viewport provides only output functionality, and is used purely for
providing layout, filling in "static" parts of it, and then uses an
object in model to output dynamic content. That variable in model, in
turn, is instantiated by the controller depending on the input (url
parameter), and may be another controller or a viewport. So, in this
case, template model is more or less template view's model :) Another
type of controller may deal with a database query, or a login
processing, or somthing else.
Having all this, it becomes quite easy to separate data from logic from
presentation, and, as a consequence, find and modify specific pieces of
them :)
luph
[Back to original message]
|