samoht Posted February 21, 2011 Share Posted February 21, 2011 Hello all, I have a directory page that is populated with a foreach loop pulling info from a db table. I want to make a "Download Directory pdf" button that will print out the directory entries in a nicely formatted way. The thing is that the foreach loop uses an OO call to what every template is being used for the HTML display: foreach ( (array) $results as $row) { ... $out .= '<div class="cn-list-row' . $alternate . ' vcard ' . $template->slug . ' ' . $entry->getCategoryClass(TRUE) . '">' . "\n"; $out = apply_filters('cn_entry_before', $out, $entry); ob_start(); include($template->file); $out .= ob_get_contents(); ob_end_clean(); $out = apply_filters('cn_entry_after', $out, $entry); $out .= '</div>' . "\n"; } $out .= '<div class="clear"></div>' . "\n"; $out .= '</div>' . "\n"; $out = apply_filters('cn_list_after', $out, $results); return $out; } Any Ideas?? Quote Link to comment Share on other sites More sharing options...
samoht Posted February 21, 2011 Author Share Posted February 21, 2011 I meant to say "whatever template is being used" include($template->file); Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 21, 2011 Share Posted February 21, 2011 if you are trying to convert HTML to PDF, i suggest that you skip it and just use FPDF to write to PDF. www.fpdf.org Quote Link to comment Share on other sites More sharing options...
samoht Posted February 21, 2011 Author Share Posted February 21, 2011 BlueSkyIS, Thanks for the link. I will use FPDF as the library. What I was not sure about was the creation of the pdf. I will read up on the tuts for FPDF - but I was hoping I wouldn't have to add to much code to the files to generate the pdf material. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.