2012-01-03 67 views
0

我试图DOMPDF集成到我们的Joomla(版本1.5.24)的项目,我不断收到这些错误:Joomla和DOMPDF集成错误

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

请帮忙!谢谢!

+0

如果你们对HTML,PDF工具,更容易使用任何建议,那么请我的客人,并发布它。到目前为止,我已经使用FPDF尝试了HTML2FPDF,并且它不符合我的要求(需要为每个生成的页面显示标题,但不知何故,生成的HTML结果不会自动将其自身定位在第二页和下面的标题后面。解决这个问题,也请分享一下:D) – spicefoo 2012-01-03 11:15:54

+0

这个错误说明它全部找不到DOMPDF类,为什么包含路径到配置文件?不应该为实际实现此类的文件创建路径吗? – Kishore 2012-01-03 11:20:37

+1

根据我在配置文件中的理解,它包含了实现DOMPDF类的文件。我认为这就是他们实施的方式。 – spicefoo 2012-01-03 11:25:19

回答

1

所有这些严格的标准你得到的警告是监守此行

的error_reporting的(E_STRICT | E_ALL);

在dompdf_config.inc.php

,你应该包括DOMPDF /包括/ dompdf.cls.php

+0

其实,因为dompdf目前的设计,你应该包括dompdf_config.inc.php。该文件设置DOMPDF需要的常量,并定义一个自动加载器,用于在渲染过程中加载必要的类文件。 – BrianS 2012-01-03 20:45:38