Hi George,

welcome to agavi ;).

I would recommend keeping the separation. It makes the code cleaner  
because every view focuses on it's own domain. Not every view is as  
simple as the views in the sample - think about pre-populating form  
data in input views, which should not happen in error and success etc.  
If you get to a point where you'd duplicate code you can still have  
the error view extend the input view or both extend a common base  
view, just as you see fit.
Keeping the views separate is not more work than mixing the code as  
the stubs get generated by the agavi commandline script and the  
cleaner structure certainly makes it worth the little extra effort.

Cheers

felix

On Sep 1, 2008, at 3:26 PM, George Pop wrote:

> Hi.
>
> I am new to Agavi. Bear with me if I enquire about the obvious.
>
> I was wondering whether the usual separation of views into "Input",  
> "Success", "Error" etc. is just a convention, or if there's a  
> functional purpose to it. I mean, is it a serious offense to mix  
> some of these views into one, especially when there's very little  
> code in either of them?
>
> Case in point, the sample application that comes with Agavi has  
> three views for the Login action: Input, Error, and Success. Now,  
> the Error view is only there to set an error on the validation  
> manager, after which it renders the template for the Input view.  
> Here's the meat of it:
>
> if(($error = $this->getAttribute('error')) !== null) {
>    $this->container->getValidationManager()->setError($error, $this- 
> >context->getTranslationManager()->_('Wrong ' . ucfirst($error),  
> 'default.errors.Login'));
> }
>
> What if I simply add this code to the Input view, and have the  
> action return "Input" instead of "Error" when the wrong credentials  
> have been entered? Am I headed for trouble?
>
> Thanks,
> George
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to