How do I use dynamic variable inside PHP tags

Probably used wrong terminology here, sorry :slight_smile:

The following is an include file used with HTML2PDF. It works well as it is, but I want to make things dynamic.

For instance I want to change the include template file from
/admin/pdf_template_AD_Report.php >> /admin/{{dynamic_template_filename}}.php
and also the output filename
neiltest.pdf >> {{dynamic_filename}}.pdf

but I don’t know how to format the Wappler generated value inside the PHP tags.

    /**
        * Html2Pdf Library - example
        *
        * HTML => PDF converter
        * distributed under the OSL-3.0 License
        *
        * @package   Html2pdf
        * @author    Laurent MINGUET <webmaster@html2pdf.fr>
        * @copyright 2017 Laurent MINGUET
    */

    require_once dirname(__FILE__).'/vendor/autoload.php';

    use Spipu\Html2Pdf\Html2Pdf;
    use Spipu\Html2Pdf\Exception\Html2PdfException;
    use Spipu\Html2Pdf\Exception\ExceptionFormatter;

    try {
        ob_start();
        include dirname(__FILE__).'/admin/pdf_template_AD_Report.php';
        $content = ob_get_clean();

        $html2pdf = new Html2Pdf('P', 'A4', 'fr');
        $html2pdf->writeHTML($content);
        $html2pdf->output('neiltest.pdf');
    } catch (Html2PdfException $e) {
        $html2pdf->clean();

        $formatter = new ExceptionFormatter($e);
        echo $formatter->getHtmlMessage();
    exit("End");
    }
?>```
Community Page
Last updated: