Reputation: 2485
I have written my code locally and everything works fine, I have tried importing it into a new system and are getting the current errors :
Warning: Missing argument 1 for Properties::__construct(), called in
/home/hghdigib/public_html/system/core/init.php on line 18 and defined in
/home/hghdigib/public_html/classes/properties_data.php on line 8
Page to display Function
include( str_replace('/core/', '/system/core/init.php', MODX_CORE_PATH) );
$db = new Mysqlidb('localhost','user','pass','database');
$properties = new Properties($db);
$properties->showLatest(3);
Init.php
define('CORE_PATH', dirname(__FILE__));
try
{
require_once("classes/database.php");
require_once("classes/properties_data.php");
require_once("classes/xml_upload.php");
}
catch (Exception $e)
{
die('Error loading system.');
}
Properties_data.php Line 1- 8
class Properties {
public $db;
function __construct($db) {
$this->db = $db;
}
Thanks
Upvotes: 0
Views: 4073
Reputation: 9092
as you use:
require_once("classes/database.php");
require_once("classes/properties_data.php");
require_once("classes/xml_upload.php");
to require file, check classes/xml_upload.php
, there may be some code to call class Properties
.
How to debug? change the Properties
to:
class Properties {
public $db;
function __construct($db = null) {
if (null == $db) {
// here you will see the back trace info
print_r(debug_backtrace());
}
$this->db = $db;
}
Upvotes: 3