I'm using tFPDF class.
I'm extending this class using this code to get custom Header and Footer
class PDF extends tFPDF{
function Header(){
$this->Image('../../images/logo-admin.png',10,6,30);
$this->SetFont('DejaVu','',13);
$this->Cell(247,10,$produto,0,0,'C',false);
$this->SetDrawColor(0,153,204);
$this->SetFillColor(98,197,230);
$this->SetTextColor(255);
$this->Cell(30,10,date('d/m/Y'),1,0,'C',true);
$this->Ln(20);
}
function Footer(){
$this->SetY(-15);
$this->SetFont('Arial','',8);
$this->Cell(0,10,'P'.chr(225).'gina '.$this->PageNo().'/{nb}',0,0,'C');
}
}
What I need to do, is to somehow change the $produto
with a variable that doesn't belong to the class.
I'm calling this class using $pdf = new PDF();
.
How may I pass a variable to this class so I can use a string, something like $pdf = new PDF('SomeString');
and use it inside the class like $this->somestring = $somestringfromoutside