theinfamousmielie Posted January 18, 2009 Share Posted January 18, 2009 Okay, yet another insurmountable one to tease your brains. Before I start, you should know that I _COULD_ extend the entire class, but that would defeat my purpose of 'simplifying' for the novice developer. Anyway ... here goes. As it stands i have a PDF controller which does its thing very well in acting as the middleman to PEAR's File_PDF class. However, it is not acting as an 'extended' class, it is its own class. The core function: CreateDocument() does the following: $this->PDFLink = &File_PDF::factory(array('orientation' => $Orientation, 'unit' => $this->Unit, 'format' => $this->PageSize), $this->ExtensionClass); okay so this is fine, and works well on every single thing except where i need to override a function as originally defined in PEAR's PDF class (File_PDF) The two functions in particular? header() and footer() ... Is there a way for me to extend in such a way as that i have the ability to 'redefine' the header() and footer() functions in a way similar to below: //$PDF = new PDFController; // my 'middleman' pdf controller class MyPDF extends PDFController { // PDFController does not extend to anything but instead calls File_PDF::factory() within one of it's functions. function header() { //overwrites PEAR function defined in File_PDF class } } $PDF = new MyPDF; $PDF->CreateDocument(); $PDF->AddPage(); // adds a page with included styles etc from header() and footer() functions Any ideas? I realise this could be impossible, but you never know, someone might know something i dont. Link to comment https://forums.phpfreaks.com/topic/141328-pear-pdf-and-custom-wrapper-class-issues/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.