Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

get_template_path()

Description

Returns the path to any template in the system.

Returns the path to any templates in the system as long as they are saved in the correct place:
- /templates (default - base templates)
- /filestore/system/templates (custom templates)
Templates will be structured in folders based on features (e.g templates/contact_sheet/
will be used for any templates used for contact sheets)

Parameters

ColumnTypeDefaultDescription
$template_name string Template names should contain the extension as well (e.g. template_1.php / template_1.html)
$template_namespace string The name by which multiple templates are grouped together

Return

string

Location

include/pdf_functions.php lines 207 to 247

Definition

 
function get_template_path($template_name$template_namespace)
    {
    global 
$storagedir;

    
$template_path '';

    
$remove_directory_listings = array('.''..');

    
// Directories that may contain these files
    
$default_tpl_dir   dirname(__FILE__) . "/../templates/{$template_namespace}";
    
$filestore_tpl_dir "{$storagedir}/system/templates/{$template_namespace}";

    if(!
file_exists($default_tpl_dir))
        {
        
trigger_error("ResourceSpace could not find templates folder '{$template_namespace}'");
        }

    
// Get default path
    
$default_tpl_files array_diff(scandir($default_tpl_dir), $remove_directory_listings);
    if(
in_array($template_name$default_tpl_files))
        {
        
$template_path "$default_tpl_dir/$template_name";
        }

    
// Get custom template (if any)
    
if(file_exists($filestore_tpl_dir))
        {
        
$filestore_tpl_files array_diff(scandir($filestore_tpl_dir), $remove_directory_listings);
        if(
in_array($template_name$filestore_tpl_files))
            {
            
$template_path "$filestore_tpl_dir/$template_name";
            }
        }

    if(
'' == $template_path)
        {
        
trigger_error("ResourceSpace could not find template '{$template_name}'");
        }

    return 
$template_path;
    }

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