CodeIgniter Forums
How to call a function from a function in the same class? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to call a function from a function in the same class? (/showthread.php?tid=46610)



How to call a function from a function in the same class? - El Forum - 11-08-2011

[eluser]TerryT[/eluser]
Struggling with this and any help is appreciated. Here's the code:

I am extending the tcpdf class to use a custom header and footer.

Code:
class Mypdf extends TCPDF

In this class I have the following:

Code:
public function newpdf($title, $subject, $report_name)
public function body_project_listing()

The first function sets up the pdf report and the second function hits the database and gets the info for the body of the report. I am trying to call body_project_listing from within newpdf by $this->body_project_listing and keep getting Fatal error: Call to undefined method Mypdf::project_body_listing() in Mypdf.php on line 116.

Line 116 is $this->project_body_listing();

Thanks