1
我有一些函数,它使用样式表&从PHP中使用OOP获取其他类的输出。 我需要使用TCPDFm生成PDF,但我面临着如何传递$ html变量的问题,我已经阅读了XHTML + CSS使用手册,它没有解释PHP变量输出。 我在这里打开我的代码,请帮助。如何在TCPDF中使用php函数和变量生成pdf
<?php
// define some HTML content with style
$html = <<<EOF
<?php $frame->HTML_DOCTYPE(); ?>
<html>
<head><?php $frame->HTML_Title($page); $frame->HTML_CSS($page); $frame->HTML_JS($page); ?></head>
<body>
<div class='container_pngfix'>
<?php echo $frame->Print_Top($page); ?>
<div class='container_magazine'>
<div class='magazine_left'>
<?php
/*if(FALSE == empty($_SESSION['wi_id']) && FALSE == empty($_SESSION['wi_type']) && 0 == strcasecmp('bride',$_SESSION['wi_type'])){*/
if ($_REQUEST['magazineId']!="") {
echo $article->Print_Magazine_Issue($_REQUEST['magazineId']);
} else if ($_REQUEST['latestissue']) {
echo $article->Print_Magazine_Issue($article->getLatestMagazineId());
} else {
if (isset($_REQUEST['magazinedate'])) { $magazinedate=$_REQUEST['magazinedate']; } else { $magazinedate=""; }
if ($magazinedate=="") { $magazinedate=date("Y-m")."-01"; }
echo $article->Print_Magazine($magazinedate);
}
/*}else{
echo "<h2>Please Login/Register first to see Magazine details</h2>";
}*/
?>
</div>
<div class='magazine_right'><?php echo $frame->Print_RightSide_Articles($page); ?></div>
<div class='clearfloat'> </div>
<?php echo $frame->get_ContextualWeb($page,"low"); ?>
</div>
</div>
<?php echo $frame->Print_Bottom_Links($page); ?>
<?php $frame->Print_Bottom($page); ?>
</div>
</body>
</html>EOF;
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_061.pdf', 'I');
?>
在这段代码中,我使用这些类的对象调用多个函数。 所有的html &页面内容都是动态生成的。我有PHP HTML代码在$ html变量中传递的问题。
你可以写我的使用情况下,一个小例子。那是使用函数,会更有帮助 – Ankit
增加了一个例子..祝你好运 –
你有什么错误吗? –