| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
interface stubMemphisTemplate extends stubObject |
|---|
| 17 |
{ |
|---|
| 18 |
|
|---|
| 19 |
* registry key for template dir setting |
|---|
| 20 |
*/ |
|---|
| 21 |
const REGISTRY_KEY_DIR = 'net.stubbles.websites.memphis.templateDir'; |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
* constructor |
|---|
| 25 |
* |
|---|
| 26 |
* @param string $baseDir directory where template files can be found |
|---|
| 27 |
* @param array $namespaces optional namespaces for patTemplate tags, default patTemplate |
|---|
| 28 |
* @param array $options optional configuration options for patTemplate |
|---|
| 29 |
*/ |
|---|
| 30 |
#public function __construct($baseDir, array $namespaces = array(), array $options = array()); |
|---|
| 31 |
|
|---|
| 32 |
/** |
|---|
| 33 |
* enables the cache |
|---|
| 34 |
* |
|---|
| 35 |
* If no cacheDir is given cache files will be stored in |
|---|
| 36 |
* stubConfig::getCachePath() . '/patTemplate'. The default prefix will be |
|---|
| 37 |
* 'tmpl_', the default patTemplate cache driver used will be the File driver. |
|---|
| 38 |
* |
|---|
| 39 |
* @param string $cacheDir optional directory to put cache files into |
|---|
| 40 |
* @param string $prefix optional prefix for cache files |
|---|
| 41 |
* @param string $type optional patTemplate cache driver |
|---|
| 42 |
*/ |
|---|
| 43 |
public function enableCache($cacheDir = null, $prefix = 'tmpl_', $type = 'File'); |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
* open any input and parse for patTemplate tags |
|---|
| 47 |
* |
|---|
| 48 |
* @param string $input name of the input (filename, shm segment, etc.) |
|---|
| 49 |
* @param string $reader optional driver that is used as reader, you may also pass a Reader object |
|---|
| 50 |
* @param array $options optional additional options that will only be used for this template |
|---|
| 51 |
* @param string $parseInto optional name of the template that should be used as a container |
|---|
| 52 |
* @return bool true, if the template could be parsed, false otherwise |
|---|
| 53 |
* @throws stubException |
|---|
| 54 |
*/ |
|---|
| 55 |
public function readTemplatesFromInput($input, $reader = 'File', array $options = null, $parseInto = null); |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
* add a variable to a template |
|---|
| 59 |
* |
|---|
| 60 |
* A variable may also be an indexed array, but not an associative array! |
|---|
| 61 |
* |
|---|
| 62 |
* @param string $template name of the template |
|---|
| 63 |
* @param string $varname name of the variable |
|---|
| 64 |
* @param mixed $value value of the variable |
|---|
| 65 |
* @return bool |
|---|
| 66 |
*/ |
|---|
| 67 |
public function addVar($template, $varname, $value); |
|---|
| 68 |
|
|---|
| 69 |
* adds several variables to a template |
|---|
| 70 |
* |
|---|
| 71 |
* Each Template can have an unlimited amount of its own variables |
|---|
| 72 |
* $variables has to be an assotiative array containing variable/value pairs. |
|---|
| 73 |
* |
|---|
| 74 |
* @param string $template name of the template |
|---|
| 75 |
* @param array $variables assotiative array of the variables |
|---|
| 76 |
* @param string $prefix optional prefix for all variable names |
|---|
| 77 |
* @return bool |
|---|
| 78 |
*/ |
|---|
| 79 |
public function addVars($template, $variables, $prefix = ''); |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
* adds a global variable |
|---|
| 83 |
* |
|---|
| 84 |
* Global variables are valid in all templates of this object. |
|---|
| 85 |
* A global variable has to be scalar, it will be converted to a string. |
|---|
| 86 |
* |
|---|
| 87 |
* @param string $varname name of the global variable |
|---|
| 88 |
* @param string $value value of the variable |
|---|
| 89 |
* @return bool |
|---|
| 90 |
*/ |
|---|
| 91 |
public function addGlobalVar($varname, $value); |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
* Adds several global variables |
|---|
| 95 |
* |
|---|
| 96 |
* Global variables are valid in all templates of this object. |
|---|
| 97 |
* |
|---|
| 98 |
* $variables is an associative array, containing name/value pairs of the variables. |
|---|
| 99 |
* |
|---|
| 100 |
* @param array $variables array containing the variables |
|---|
| 101 |
* @param string $prefix optional prefix for variable names |
|---|
| 102 |
* @return bool |
|---|
| 103 |
*/ |
|---|
| 104 |
public function addGlobalVars($variables, $prefix = ''); |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
* returns a parsed template |
|---|
| 108 |
* |
|---|
| 109 |
* If the template already has been parsed, it just returns the parsed template. |
|---|
| 110 |
* If the template has not been loaded, it will be loaded. |
|---|
| 111 |
* |
|---|
| 112 |
* @param string $name optional name of the template |
|---|
| 113 |
* @param bool $applyFilters optional whether to apply output filters |
|---|
| 114 |
* @return string |
|---|
| 115 |
* @throws stubException |
|---|
| 116 |
*/ |
|---|
| 117 |
public function getParsedTemplate($name = null, $applyFilters = false); |
|---|
| 118 |
} |
|---|
| 119 |
?> |
|---|