Posts Tagged ‘Clade’

Clade V 1.0

Friday, June 13th, 2008

Clade is a Filipino made MVC framework. Written by yours truly. It’s basically open for the public to criticize, positively or not. Would love to hear your comments. So far, not much documentation coz I hate to write, but perhaps if I have spare time, I’ll have PHPDoc help me.

You can download it here.

If you’d like to contribute, please drop me a comment.

creating a clade model

Wednesday, April 16th, 2008

Basically, models are classes that represents a certain object. Clade Models extends the ActiveRecord class. The ActiveRecord class contains finders and other methods to manage the database. Since Clade is an MVC Framework, we will then discuss the basics in creating a model. Models must be located under app/models/ directory. The filename of the model to be created must be also the class name of the model.

Now, let’s try creating a model called User. The following code is a template of a model class.

class User extends ActiveRecord{

public function __construct($post = ”)

{

$this->tablename = ‘users’;

$this->property = $post;

parent::__construct();

}

}

Now we’ll create a model called User. Create a class called User and extend ActiveRecord.

class User extends ActiveRecord{

Models have constructors that is executed when the model is instantiated. The method __construct is a reserved keyword in PHP5 that serves as a constructor of a class. A default argument post is optional and can be used to pass any variable when the model is instantiated.

public function __construct($post = ”)

Models are basically a representation of an object. We need to specify the name of the table that this object will interact with. This example interacts with the “users” table, we will then assign the name of the table that we are going to use to this variable.

$this->tablename = ‘users’;

The assignment below assigns all posted variables to class attribute “property” if POST variable is passed in to the constructor of this model.

$this->property = $post;

We will then call the constructor of this model which is the ActiveRecord class.

parent::__construct();

Now, we’re done creating a model.

clade db config

Wednesday, April 16th, 2008

All configuration files are located at config/ directory. By default, the database configuration is located in database.php under the config/ directory. Below is the detailed description of the database configuration.

Set the host name where the database is hosted. By default, the database host is located in the same machine of the web server, therefore, we use localhost.

$config[’HOST’] = ‘localhost’;

Set the user name authorized to access the database that will be used.

$config[’USER’] = ‘username;

Set the password of the user.

$config[’PASS’] = ‘password’;

Set the name of the database that will be used.

$config[’DB’] = ‘noypi’;

Clade Framework (Introduction)

Wednesday, April 16th, 2008

Another MVC Framework? Yes, another MVC Framework, a filipino written MVC Framework. Evolving into a very dynamic framework, and despite of the hectic schedule, I’m getting this baby done. Still very immature and young but hopeful.

Stay tuned for more updates.

A Filipino MVC Framework by iyanski. If you want to contribute to Clade whether financially or technically(contribute code), please feel free to email me. I would appreciate it a lot.