本文整理汇总了PHP中Printer::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::render方法的具体用法?PHP Printer::render怎么用?PHP Printer::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($invoice)
{
parent::__construct();
$this->setTo($invoice->customer_email, $invoice->customer_name);
// To get all the properties loaded for the template
foreach ($invoice->Items as $it) {
$it->refreshRelated();
}
$data[] = $invoice;
$model = get_class($invoice);
$printer = new Printer($model, TemplateTable::getTemplateForModel($model)->getId());
try {
$body = $printer->render($data);
$pdf = $printer->renderPdf($data)->output();
$attachment = new Swift_Attachment($pdf, $model . '-' . $invoice->getId() . '.pdf', 'application/pdf');
$this->setSubject(PropertyTable::get('company_name') . ' [' . $model . ': ' . $invoice . ']')->setBody($printer->render($data), 'text/html')->attach($attachment);
$this->setReadyState(true);
} catch (LogicException $e) {
$this->setReadyState(false);
}
}
示例2: render
private function render($model = 'Invoice', $pdf = false)
{
sfConfig::set('sf_web_debug', false);
$template = TemplateTable::getTemplateForModel($model);
$printer = new Printer($model, $template->getId());
$data = $this->getInvoiceDataFromRequest($this->getRequest());
return $pdf ? $printer->renderPdf($data) : $printer->render($data);
}