Created
December 6, 2013 00:23
Revisions
-
EricYue2012 created this gist
Dec 6, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ //excel layout <?php header ("Expires: Mon, 28 Oct 2008 05:00:00 GMT"); header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); header ("Content-type: application/vnd.ms-excel"); header ("Content-Disposition: attachment; filename=\"report_".date('dmy_His').".xls" ); header ("Content-Description: Generated Report" ); ?> <?php echo $content_for_layout ?> //$content_for_layout example : basic table <table> <tr> <th width="10%">Guest Name</th> <th width="10%">Partner Name</th> <th width="10%">Company Name</th> </tr> <?php foreach ($bookings as $booking): ?> <tr> <td> <?php echo $booking['Guest']['name'] . ' ' . $booking['Guest']['surname']; ?> </td> <td> <?php echo $booking['Partner']['name'] . ' ' . $booking['Partner']['surname']; ?> </td> </tr> <?php endforeach; ?> </table> //controller: the layout 'excel' is the one defined above $this->render($render,'excel');