Class not found error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KeithStephens803
Forum Newbie
Posts: 1
Joined: Thu Feb 18, 2010 12:22 pm

Class not found error

Post by KeithStephens803 »

I am getting Class 'index' not found in Eval() code.


//write config

$path = dirname(__FILE__).DS.'..'.DS.'paymentclass';

if ( $model->payment_class ) {

if (include_once($path.DS.$model->payment_class )) {
eval( "\$_PAYMENT = new ".str_replace('.php', '', $model->payment_class)."();");
}
}else {
include( $path."pcl_payment.php" );
$_PAYMENT = new pcl_payment();
}
$_PAYMENT->write_configuration();

//end write


Why??????
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Class not found error

Post by AbraCadaver »

Two possibilities:

1. There is no Class index in $path.DS.$model->payment_class
2. The path is wrong and you've run an include_once on this file already

E_ALL error reporting will show you if it is #2. If not, then it is #1.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply