I am doing this currently,
class Page {
// variable to hold DBC class
public $dbc;
/*
__CONSTRUCT
Called when class is initiated and sets the dbc variable to hold the DBC class.
*/
public function __construct() {
// set the dbc variable to hold the DBC class
$this -> dbc = new DBC();
}
/*
CREATE PAGE
Create a page with the option to pass data into it.
*/
public function create($title, $class, $data = false) {
// start buffer
ob_start('gz_handler');
// content
content($this -> dbc, $data);
// end buffer and flush
ob_end_flush();
}
}
I have simplified the example, but basically I need to pass the object DBC
to a function inside the method create
?
Is this considered bad practice as I was using extends
before but realised there was no way to extract the extended class to a variable?
Thanks