-
Book Overview & Buying
-
Table Of Contents
CouchDB and PHP Web Development Beginner's Guide
By :
Let's add two little functions to our lib/bones.php file that will help us use forms.
1. Add a function called form that looks as follows:
public function form($key) {
return $_POST[$key];
}
2. Add a function called make_route. This function will allow our Bones instance to create clean links so that we can link to other resources in our application:
public function make_route($path = '') {
$url = explode("/", $_SERVER['PHP_SELF']);
if ($url[1] == "index.php") {
return $path;
} else {
return '/' . $url[1] . $path;
}
}
We added a simple function called form that serves as a wrapper around the $_POST array, which is an array of variables passed through the HTTP POST method. This will allow us to collect values after we POST them. The next function we created is called make_route. This function will soon be used everywhere to create clean links so that we can link to other resources in our application.
Change the font size
Change margin width
Change background colour