gnuherds-app-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comments on the new architecture


From: Klaus Weiss
Subject: Re: Comments on the new architecture
Date: Mon, 07 May 2007 18:09:47 +0200

Next update! 

It is now possible to validate user input in an easy manner. Here is a
short example:

Every controller can access the variable $this->data, which is an
special data array. It can has the following structure:

Array
{
  ['GET'] => Array
             {
               ['lang'] => 'en_EN',
               ['foo'] => 'bar'
               ...
             }
  ['User'] => Array
              {
                ['email'] => 'address@hidden',
                ['password'] => '0xdeadbeef',
                ...
              }
  ...
}

The former entry comes obviously from HTTP GET. The latter is more
interesting here. 'User' is actually a model which is described in a
model file inside /site/model/. 

The User model contains the following array:

public $validate = array('email' => VALID_EMAIL,
                         'password' => VALID_NOT_EMPTY);

It is pretty straightforward what that means. If a validation fails on a
specific field the entry in the $this->data array is changed to false.
In addition a error trigger is called if someone is found.

To see how forms are build and error triggers created look at the
default.html.














reply via email to

[Prev in Thread] Current Thread [Next in Thread]