Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

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 258 to 293

Definition

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

    
// General placeholders available to templates
    
$general_params = array(
        
'applicationname' => $applicationname,
        
'baseurl'         => $baseurl,
        
'baseurl_short'   => $baseurl_short,
        
'filestore'       => $storagedir,
        
'lang'            => $lang,
        
'date'            => nicedate(date('Y-m-d H:i:s'), $contact_sheet_date_include_time$contact_sheet_date_wordy),
    );

    if(
'' != $linkedheaderimgsrc)
        {
        
$general_params['linkedheaderimgsrc'] = $linkedheaderimgsrc;
        }

    
$bind_params array_merge($general_params$bind_placeholders);

    foreach(
$bind_params as $bind_param => $bind_param_value)
        {
        $
$bind_param $bind_param_value;
        }

    
// 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;
    
$content ob_get_clean();

    return 
$content;
    }

This article was last updated 27th November 2020 18:05 Europe/London time based on the source file dated 9th September 2020 09:35 Europe/London time.