-
Book Overview & Buying
-
Table Of Contents
CouchDB and PHP Web Development Beginner's Guide
By :
Now that we have our Base class created, let's create a User class that will house the properties and functions for all things related to users.
1. Create a new file called user.php, and place it in the classes folder along with base.php.
2. Let's create a class that extends our Base class.
<?php
class User extends Base
{
}
3. Let's add the two properties that we know we need so far: name and email, into our User class.
<?php
class User extends Base
{
protected $name;
protected $email;
}
4. Let's add a __construct function that will tell our Base class that our document type is user on creation.
<?php
class User extends Base
{
protected $name;
protected $email;
public function __construct()
{
parent::__construct('user');
}
}
We created a simple class called user.php that extends Base. Extends means that it will inherit the properties and functions that are available so that we can take advantage of them. We then included...
Change the font size
Change margin width
Change background colour