本文整理匯總了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);
}