Programming in Magento Way
Get URL
Root URL
<a href="<?php echo $this->getUrl('') ?>"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
Skin URL
$this->getSkinUrl('css/hejian-custom.css');
Display a CMS block in phtml
echo $this->getLayout()->createBlock('cms/block')->setBlockId('additional_info')->toHtml();
PDF generate
Module function:
public function getPdf() {
$pdf = new Zend_Pdf();
$style = new Zend_Pdf_Style();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
……
return $pdf;
}
Controller function:
function pdfAction() {
$pdf = Mage::getModel('xxx')->getPdf();
return $this->_prepareDownlaodResponse('xxx.pdf', $pdf->render(), 'application/pdf');
}