(I'm really sorry if this is being sent repeatedly, but I had some trouble subscribing -- not really sure what the deal was, but I think I'm here now.)

Hey there all --

I've been trying to understand ZF recently and I am having trouble wrapping my mind around something. I think it'll be easiest if I quickly explain how I usually do things:

I run a website for a small alt-weekly and have come to think of pieces of my layout as separate little "objects" with methods and properties. I have php classes like "articles","comments","guide" and "calendar" which correspond to tables in a database, and which can execute logic based on arguments given and return an HTML output string.

So on any given page displaying, say, an article about turtles*, might be comprised of objects which display the article itself, a list of related articles, a box listing recent comments about the article, links to listings in our town "guide" relevant to the article, relevant calendar listings, etc., based on arguments passed through the URL to the controlling page, and to the objects inside.

It seems like each of these objects sort of follows the controller/ action concept, if they were individual pages, rather than objects returning HTML. And I might want to use these same "objects" in different context on a different section of the site, so I like having these php classes to turn to, and I'm not duplicating the code.

Now... is that what "modules" are in Zend Framework? Would it make sense to turn my "articles", "comments" (etc.), my php classes into ZF modules? They certainly have their own structure, logic and actions. Though I haven't designed it that way originally, I could see how each could be divided into an MVC pattern and I think I like it.

Now, if that is the case, how to I go about creating that master page? I suppose I could have a controller page and in actions for that page, make calls to the various modules. Like "/weekly/read/..." or "/calendar/display/...", which would feed arguments to the modules, which would return HTML; but is there an intended way to simply return the view's HTML output, say, in a method of the module? Where would I find that way? Or is it a bad idea? I would love if someone could point me in the right direction here... I'm having trouble with some of the terminology and not positive where to focus my studies. Maybe it's not modules at all.

Any help would be much appreciated, as I keep coming back to this same issue.

Thanks in advance,
Ian R


*this is not a very realistic example, but seeing it now, I wish that it were.

Reply via email to