Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: PHP Formular mit dynamischer PDF Anhang

    karabey

    • Schreiberling
    • Beiträge: 320
    • Geschlecht:
    PHP Formular mit dynamischer PDF Anhang
    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-attachment

    Das 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.

    Code: PHP  [Auswählen]
    // Check for blank fields
    if (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
    Zitat
    "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
    6 Antworten
    2670 Aufrufe
    30. Oktober 2010, 16:36:08 von Tomcraft
    13 Antworten
    6268 Aufrufe
    03. März 2015, 17:51:05 von Gradler
    1 Antworten
    3374 Aufrufe
    08. Juni 2010, 07:54:41 von Chilonivm
    6 Antworten
    4372 Aufrufe
    06. November 2011, 10:12:32 von rubber-ducks