我正在尝试将DOMPDF集成到我们的Joomla(版本1.5.24)项目中,并且我一直收到这些错误:
Strict standards: Non-static method JLoader::load() should not be called statically in C:\xampp\htdocs\proj\libraries\loader.php on line 162
Strict standards: Non-static method JLoader::register() should not be called statically in C:\xampp\htdocs\proj\libraries\loader.php on line 139
Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\proj\components\com_reports\views\details\view.pdf.php on line 23
Strict standards: Non-static method JFactory::getDBO() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\session\storage\database.php on line 84
Strict standards: Non-static method JTable::getInstance() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\session\storage\database.php on line 89
Strict standards: Non-static method JFactory::getDBO() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\oasis\libraries\joomla\database\table.php on line 112
实例化DOMPDF对象的函数位于组件的一个视图中:
class ReportsViewDetails extends JView{
function display($tpl = null){
global $mainframe;
//echo "hello";
$this->generatePDF();
}
function generatePDF(){
require_once("./components/com_reports/helper/dompdf/dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
}
}
它会看到所需的文件,但dompdf_config.inc.php会输出上述错误。我不确定是什么导致了这个,因为该文件只包含define
行和autoload
函数。该文件的内容可以在这里看到:http://code.google.com/p/dompdf/source/browse/trunk/dompdf/dompdf_config.inc.php。
请帮忙!谢谢!