Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 261 to 295

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;

    return 
ob_get_clean();
    }

This article was last updated 19th March 2024 11:35 Europe/London time based on the source file dated 8th March 2024 15:10 Europe/London time.