Am 27.01.2008 um 05:53 schrieb jason simmons:
> Hi everyone,
>
> I have been using Mojavi for a number of years now and it is
> starting to really show its age now. PHP4 is going EOL and I had
> better move up to the latest development.
>
> The reason why I liked Mojavi over other frameworks is because of
> it's power and simplicity. It was very easy to create a solid
> structure to build an application , and it was quick, And it used
> the file system as its config. As long as you stuck to the filename
> convention you were ok. You did not have to spend ages setting up
> loads of setup files to get running. Plus I found an extremely good
> tutorial which setup me nicely with the framework.
>
> http://www.peterrobins.co.uk/it/mojavi/tutorial1.htm
>
> I want to move up to agavi over other frameworks because it still
> looks light on it's feet, does not force me to mess with my apache
> config, and I don't HAVE to use an ORM database abstraction layer
> and I can still relate to elements of mojavi. Ok, you now have a
> bunch of XML files to configure, however I can live with that
> compared to other frameworks.
>
> agavi has a severe lack of documentation which I know is being
> addressed, Therefore it is taking me a bit of time to see how to
> implement some of the features I'm used to. And I already see some
> new features I really like. However it is really slow jumping from
> extended class to extended class to see how the framework hangs
> together. What would be cool is to see some working apps using some
> the key features filters, Models, DBUser Sessions, Model Error
> handling ( Action->HandleError mojavi), Filters (Global and Module)
We still have handleError(). Check out the comment in an Action "agavi
action" creates for you. It explains how those work, since there can
also be handleWriteError() for request method "write" (HTTP POST maps
to that in a WebRequest) etc.
> I'm happy to write something like that once I get up to speed.
Awesome. We're hoping have a documentation system up and running in
the next weeks.
> I have checked the list archive to get some more clues, but I could
> not find anything to fill my gaps of knowledge. Most of the postings
> I found explained changes made, rather than conceptually how the
> frameworks is invoked and used.
>
> Here are some the things I'm looking to understand
>
> Views Templates/ Renderer's:
> ----------------------------------
> What is a slot/Layer ?
Slots... can also be found in Mojavi 3. Just a normal action, that is
run, and the output is available in the template. In Mojavi, that was
just in a decorator template, which is kind of a "master" template
that wraps the inner content template.
> What was a decorator ?
See above :)
> How are they used ?
You normally configure them in layouts in output_types.xml. You can
also define them by hand using createLayer(), appendLayer() etc in the
view.
> How can specify my own template names in Views , rather than just
> IndexSucces.php etc etc?
$this->getLayer('layername')->setTemplate('IndexSuccess2');
> How do I point 2 views at the same template ?
See above :) I assume you have an ErrorView and an InputView which
both use the same template. That is exactly the way to go. Good!
I hope you're aware of the Form Population Filter and what it can do
for you. Drop by the IRC channel to learn more about it until we have
docs on it. It refills forms for you, inserts error messages for you,
can pre-fill forms (e.g. a profile edit form), flag erroneous fields
etc.
> How do I return a view in a different module ? return
> array('ModuleName','HomeIndex',VIEW_SUCCESS);
return array('ModuleName', 'ViewName');
We used to have stuff like
return AgaviView::SUCCESS;
but that is nonsense... you can't change the constant, so you can't
refactor things this way... it just confused people, so now you do
return 'Success';
which is just as portable and maintanable (= not at all).
> Models
> -----------
> Does validation & filters run before Actions or Models
Before actions. Filters wrap a run inside an execution container
(action filters) or the dispatch() call (global filters)
You use models in your actions.
> Do you use an extended AgaviAttributeHolder to pass data between
> actions<->Models
No, you just do $this->setAttribute('foo', 'bar'); in the action. the
data is gonna be in the view ($this->getAttribute()), and
automatically assigned to the template unless you clear the attribute.
> Sessions
> --------------
> How I do change session handlers ?
factories.xml, and define a different storage.
> Do I do my own cookie management ( $request->getCookies() )
cookies are in the request data. they are user supplied input, so they
go through the same validation channels as headers, parameters and
files do.
setting cookies is done on the response. note that this is behavior or
presentation, so you should do it in the view, not in the action, so
the action is reusable (for your SOAP web service implementation the
boss asks for next week). use $this->getResponse() (which pulls from
the container)
> Errors
> ---------
> How do I track field validation errors ( $request->getError |
> $request->setError)
> How do I invoke my own errors ( Eg, businses logic )
Foo.xml in validate/ for action Foo can be used to define validation
rules. Also, you can use registerValidators(), and validate() by hand.
Again, validateWrite() to validate only on POST etc. Each container
has a validation manager that tracks errors, incidents etc.
> I know I'm asking newbie questions, but all I need is a bit of
> comprehensive code so I can see how the framework is being used.
> I'll soon be up to speed.
Absolutely not. We're happy to help. You'll likely get the best and
quickest help on IRC, since many people lurk there :)
HTH,
David
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users