process_template()

Description

Function used to process a template

Process template and bind any placeholders. The template should contain (if needed) PHP statements which will
will be processed through this function.

Parameters

ColumnTypeDefaultDescription
$template_path string The full path to the location of the template (as returned by get_template_path())
$bind_placeholders array array A map of all the values that are meant to replace any placeholders found in the template

Return

string

Location

include/pdf_functions.php lines 232 to 253

Definition

 
function process_template($template_path, array $bind_placeholders = array())
{
    global 
$applicationname$baseurl$baseurl_short$storagedir$lang$linkedheaderimgsrc;
    global 
$contact_sheet_date_include_time$contact_sheet_date_wordy$pdf_properties;

    
// General placeholders available to templates
    
$applicationname $bind_placeholders['applicationname'] ?? $applicationname;
    
$baseurl         $bind_placeholders['baseurl'] ?? $baseurl;
    
$baseurl_short   $bind_placeholders['baseurl_short'] ?? $baseurl_short;
    
$filestore       $bind_placeholders['filestore'] ?? $storagedir;
    
$lang            $bind_placeholders['lang'] ?? $lang;
    
$date            $bind_placeholders['date'] ?? nicedate(date('Y-m-d H:i:s'), $contact_sheet_date_include_time$contact_sheet_date_wordy);

    
// Sometimes, HTML2PDF complains about headers being already sent
    
ob_end_clean();

    
// At this point we shoud have all the placeholders we need to render the template nicely
    
ob_start();
    include 
$template_path;

    return 
ob_get_clean();
}

This article was last updated 26th April 2025 09:05 Europe/London time based on the source file dated 21st January 2025 15:20 Europe/London time.