Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
double class declaration problem
Old 02-02-2009, 09:50 AM double class declaration problem
Skilled Talker

Posts: 83
Trades: 0
Hello,

I am having a problem with the following.

PHP Code:
include("pdf_micrographx.php");
$mailen "ja";
include(
"pdf_micrographx.php"); 
In pdf_micrographx.php i am declaring a class. No problem.

But now i want to extend that class as follows:
PHP Code:
// Extend the TCPDF class to create custom Header and Footer 
class MYPDF extends TCPDF 
    
//Page header 
    
public function Header() { 
        
$this->Cell(3010'Title'00'C'); 
    } 
 
    
// Page footer 
    
public function Footer() { 
        
$this->Cell(010'Page'00'C'); 
    } 

// create new PDF document 
$pdf = new TCPDF('P''mm''A4'true'UTF-8'false); 
But when i do this i get an error that i have already declared my class. Seems logic to me, since i include the file twice. But what i dont understand is why i do not get that error, if i do not extend the class, and simply replace the above with:
PHP Code:
$pdf = new MYPDF('P''mm''A4'true'UTF-8'false); 
Any suggestions as to why i only get an error when i extend the class, and how to solve the error?

thanks!

Matt

Last edited by killerwhale65; 02-02-2009 at 09:51 AM..
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-02-2009, 10:18 AM Re: double class declaration problem
Skilled Talker

Posts: 83
Trades: 0
solved:
PHP Code:
// Extend the TCPDF class to create custom Header and Footer 
if (!isset($mailen)) {
 class 
MYPDF extends TCPDF 
  
//Page header 
  
public function Header() { 
   
$this->Cell(3010'Title'00'C'); 
  } 
   
  
// Page footer 
  
public function Footer() { 
   
$this->Cell(010'Page'00'C'); 
  } 
 } 
}
// create new PDF document 
$pdf = new MYPDF('P''mm''A4'true'UTF-8'false); 
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to double class declaration problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09784 seconds with 12 queries