3 * An interface for template engines
5 * @author Roland Haeder <webmaster@ship-simu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.ship-simu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 interface CompileableTemplate extends FrameworkInterface {
26 * Assign variables for templates
28 * @param $var The "variable" we want to assign
29 * @param $value The value we want to store in the variable
32 function assignVariable ($var, $value);
35 * Load a specified web template into the engine
37 * @param $template The web template we shall load which is located in
41 function loadWebTemplate ($template);
44 * Load a specified code template into the engine for later compilation
45 * with other code/web/email templates.
47 * @param $template The code template we shall load which is
48 * located in "html" by default
51 function loadCodeTemplate ($template);
54 * Compile all variables by inserting their respective values
58 function compileVariables ();
62 * Compile all required code/web/email-templates into the current one
66 function compileTemplate ();
69 * Adds a variable to current group
71 * @param $var Variable to set
72 * @param $value Value to store in variable
75 function addGroupVariable ($var, $value);
78 * Removes a given variable
80 * @param $var The variable we are looking for
83 function removeVariable ($var);
86 * Assign a given congfiguration variable with a value
88 * @param $var The configuration variable we want to assign
91 function assignConfigVariable ($var);
94 * Compiles configuration place-holders in all variables. This 'walks'
95 * through the variable stack 'general'. It interprets all values from that
96 * variables as configuration entries after compiling them.
100 function compileConfigInVariables ();
103 * Assigns the last loaded raw template content with a given variable
105 * @param $templateName Name of the template we want to assign
106 * @param $variableName Name of the variable we want to assign
109 function assignTemplateWithVariable ($templateName, $variableName);
112 * Transfers the content of this template engine to a given response instance
114 * @param $responseInstance An instance of a response class
117 function transferToResponse (Responseable $responseInstance);
120 * Assigns all the application data with template variables
122 * @param $appInstance A manageable application instance
125 function assignApplicationData (ManageableApplication $appInstance);
128 * "Compiles" a variable by replacing {?var?} with it's content
130 * @param $rawCode Raw code to compile
131 * @param $setMatchAsCode Sets $match if readVariable() returns empty result
132 * @return $rawCode Compile code with inserted variable value
134 function compileRawCode ($rawCode, $setMatchAsCode=false);
137 * Renames a variable in code and in stack
139 * @param $oldName Old name of variable
140 * @param $newName New name of variable
143 function renameVariable ($oldName, $newName);
146 * Renders the given XML content
148 * @param $content Valid XML content or if not set the current loaded raw content
150 * @throws XmlParserException If an XML error was found
152 function renderXmlContent ($content = null);
155 * Enables or disables language support
157 * @param $languageSupport New language support setting
160 function enableLanguageSupport ($languageSupport = true);
163 * Checks wether language support is enabled
165 * @return $languageSupport Wether language support is enabled or disabled
167 function isLanguageSupportEnabled ();
170 * Enables or disables XML compacting
172 * @param $xmlCompacting New XML compacting setting
175 function enableXmlCompacting ($xmlCompacting = true);
178 * Checks wether XML compacting is enabled
180 * @return $xmlCompacting Wether XML compacting is enabled or disabled
182 function isXmlCompactingEnabled ();