Hi guys,
After your previous advice. I have been looking at some more OOP for my
application. Is this the sort of way a proper OOP application should be
constructed?
I want to use smarty as my template language as well, how could I integrate
that?
<?php
class Base {
function test_base() {
echo 'Some other functions in here maybe?';
}
}
class Error extends Base {
function raise_error() {
echo 'I am raising an error';
}
}
class Database extends Error {
function connect($details = '') {
echo "Connecting to the database<br />";
// get connections details
list($host, $username, $password, $type) = $details;
// connect to the database
if($connection = mysql_connect($host, $username, $password)) {
$this->raise_error();
}
}
}
class Login extends Database {
function Login() {
echo "Hello, I'm the Login class<br />";
// connect to the database
$this->connect();
}
}
$c = new Database;
$c->connect();
Any pointers would be great :)
Cheers,
Jord
--
Jordan Elver
You don't have to be mad to work here, but you do have to be on time, well
presented, a team player, customer service focused and sober!! -- David Brent
(The Office)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php