I use Codeigniter to build something. But I have problem when I tried to build module print. I want to use variable that sent from my controller. see my controller script below
public function print_data()
{
$this->load->library('Pdf');
$config = $this->config->item('basmalah');
$data['config'] = $config; //will send data to view
$this->load->view('/print_laporan_cashdraw',$data);
}
And my view like this
// print_r($config);exit;
$conf = $config;
class MYPDF extends TCPDF {
//Page header
public function Header() {
$this->SetFont('helvetica', '', 12);
$this->Write(0, 'PT. BASMALAH SIDOGIRI - '.$conf['bas_branch_name'], '', 0, 'C', true, 0, false, false, 0);
$this->Write(0, $conf['bas_branch_address'], '', 0, 'C', true, 0, false, false, 0);
// $this->Cell(0, 15, 'PT. BASMALAH SIDOGIRI', 0, false, 'C', 0, '', 0, false, 'M', 'M');
$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '0', 'phase' => 10, 'color' => array(0, 0, 0));
$this->Line(10, 24, 200, 24, $style);
}
}
i have checked with print_r
function its containt data, but i can't access variable
$config
in method Header. What should I do?