ghgarcia Posted August 13, 2007 Share Posted August 13, 2007 Is it possible to have multiple class function within the same application. I have a need to use my current class functions and an additional one to send SMTP emails (PHPMailer) Any help would be greatly appreciated. George Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/ Share on other sites More sharing options...
keeB Posted August 13, 2007 Share Posted August 13, 2007 Sure.. <?php class MyClass1 { public function a($b) { return $c; } } class MyClass2 { public function d($e) { return $f; } } $g = new MyClass1; $h = new MyClass2; ?> etc, etc Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-322101 Share on other sites More sharing options...
ghgarcia Posted August 13, 2007 Author Share Posted August 13, 2007 I must have something wrong with my code I load my normal variables for my application with a class of football. I then load another php file which loads the other class i.e. require ("mail.inc.php"); // get SMTP information $mail = new MyMailer; The application mail.inc.php does the following: require("class.phpmailer.php"); class MyMailer extends PHPMailer { When I attempt to use any variables i.e. echo $mail->time; nothing is shown. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-322981 Share on other sites More sharing options...
lemmin Posted August 13, 2007 Share Posted August 13, 2007 Is the time variable initialized? You might need to post more code. Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-322987 Share on other sites More sharing options...
ghgarcia Posted August 13, 2007 Author Share Posted August 13, 2007 Yes it's part of the mail class. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-322990 Share on other sites More sharing options...
keeB Posted August 14, 2007 Share Posted August 14, 2007 What's the error? Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-323114 Share on other sites More sharing options...
ghgarcia Posted August 14, 2007 Author Share Posted August 14, 2007 That's one of the problems I get no errors at all which is strange. If I had an error I could react. Thanks, George Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-323134 Share on other sites More sharing options...
hitman6003 Posted August 14, 2007 Share Posted August 14, 2007 Make sure display errors is on: error_reporting(E_ALL); ini_set('display_startup_errors','1'); ini_set("display_errors", 1); Also, I think you need to instantiate a class with parenthesis: $mail = new MyMailer(); Quote Link to comment https://forums.phpfreaks.com/topic/64603-multi-classes/#findComment-323146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.