am: 11. Juni 2013, 14:57:50
Hallo,
Hab ein Formular gefunden das den Inhalt des Formulars als PDF an dem Empfänger zusendet.
http://coreyworrell.com/blog/article/php-html-email-pdf-attachmentDas gute an dem ganzen ist das der PDF Layout ganz einfach konfigurierbar ist. Nur gibt es ein Problem beim absenden des Formulars.
Wenn ich die Datei
"form.php" in eine neue Content Seite einfüge und den Formular absenden möchte funktioniert es mit dem aufruf der restlichen Dateien nicht.
// Check for blank fieldsif (empty($post->name) OR
empty($post->email) OR
empty($post->about)) $error = true;else { // Get this directory, to include other files from $dir = dirname(__FILE__); // Aufruf // $dir = "http://".$_SERVER['HTTP_HOST']."/media/content"; // Get the contents of the pdf into a variable for later ob_start(); require_once($dir.'/pdf.php'); $pdf_html = ob_get_contents(); ob_end_clean(); // Load the dompdf files require_once($dir.'/dompdf/dompdf_config.inc.php'); $dompdf = new DOMPDF
(); // Create new instance of dompdf $dompdf->load_html($pdf_html); // Load the html $dompdf->render(); // Parse the html, convert to PDF $pdf_content = $dompdf->output(); // Put contents of pdf into variable for later // Get the contents of the HTML email into a variable for later ob_start(); require_once($dir.'/html.php'); $html_message = ob_get_contents(); ob_end_clean(); // Load the SwiftMailer files require_once($dir.'/swift/swift_required.php'); Ergänze ich den Teil mit
"$dir = dirname(__FILE__);" mit dem Teil
"$dir = "http://".$_SERVER['HTTP_HOST']."/media/content";" dann kommt die Meldung
"Fatal error: Class 'DOMPDF' not found in www/xtc/media/content/form.php on line 35"
Wenn ich das mit Hilfe hinbekomme kann ich es zusammenfassen und als Modul hinstellen.
Danke
LG
karabey
Linkback: https://www.modified-shop.org/forum/index.php?topic=26535.0