first import
[projectpier.git] / public / install / library / functions.php
blobd60ad15da68375127ae1252128360345d58fb1eb
1 <?php
3 include_once INSTALLATION_PATH . '/environment/functions/general.php'; // general functions
5 // ---------------------------------------------------
6 // Templates
7 // ---------------------------------------------------
9 /**
10 * Return full path of specific template file
12 * @param string $tpl_file
13 * @return string
15 function get_template_path($tpl_file) {
16 return INSTALLER_PATH . '/installation/templates/' . $tpl_file;
17 } // get_template_path
19 /**
20 * Assign template variable.
22 * If you want to assign multiple variables with one call pass associative array
23 * through $varname. In that case $varvalue will be ignored!
25 * @param mixed $varname Variable name or associative array of variables that need
26 * to be assigned
27 * @param mixed $varvalue Variable name. If $varname is array this param is ignored
28 * @return boolean
30 function tpl_assign($varname, $varvalue = null) {
31 $template_instance = Template::instance();
32 if(is_array($varname)) {
33 foreach($varname as $k => $v) {
34 $template_instance->assign($k, $v);
35 } // foreach
36 } else {
37 $template_instance->assign($varname, $varvalue);
38 } // if
39 } // tpl_assign
41 /**
42 * Render template and return it as string
44 * @param string $template Template that need to be rendered
45 * @return boolean
47 function tpl_fetch($template) {
48 $template_instance = Template::instance();
49 return $template_instance->fetch($template);
50 } // tpl_fetch
52 /**
53 * Render specific template
55 * @param string $template Template that need to be rendered
56 * @return boolean
58 function tpl_display($template) {
59 $template_instance = Template::instance();
60 return $template_instance->display($template);
61 } // tpl_display