3 * An interface for template engines
5 * @author Roland Haeder <webmaster@shipsimu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2013 Core Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.shipsimu.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 $variableName The "variable" we want to assign
29 * @param $value The value we want to store in the variable
32 function assignVariable ($variableName, $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 $variableName Variable to set
72 * @param $value Value to store in variable
75 function addGroupVariable ($variableName, $value);
78 * Removes a given variable
80 * @param $variableName The variable we are looking for
81 * @param $variableGroup Name of variable group (default: 'general')
84 function removeVariable ($variableName, $variableGroup = 'general');
87 * Assign a given congfiguration variable with a value
89 * @param $variableName The configuration variable we want to assign
92 function assignConfigVariable ($variableName);
95 * Compiles configuration place-holders in all variables. This 'walks'
96 * through the variable stack 'general'. It interprets all values from that
97 * variables as configuration entries after compiling them.
101 function compileConfigInVariables ();
104 * Assigns the last loaded raw template content with a given variable
106 * @param $templateName Name of the template we want to assign
107 * @param $variableName Name of the variable we want to assign
110 function assignTemplateWithVariable ($templateName, $variableName);
113 * Transfers the content of this template engine to a given response instance
115 * @param $responseInstance An instance of a response class
118 function transferToResponse (Responseable $responseInstance);
121 * Assigns all the application data with template variables
123 * @param $applicationInstance A manageable application instance
126 function assignApplicationData (ManageableApplication $applicationInstance);
129 * "Compiles" a variable by replacing {?var?} with it's content
131 * @param $rawCode Raw code to compile
132 * @param $setMatchAsCode Sets $match if readVariable() returns empty result (default: FALSE)
133 * @return $rawCode Compile code with inserted variable value
135 function compileRawCode ($rawCode, $setMatchAsCode = FALSE);
138 * Renames a variable in code and in stack
140 * @param $oldName Old name of variable
141 * @param $newName New name of variable
144 function renameVariable ($oldName, $newName);
147 * Renders the given XML content
149 * @param $content Valid XML content or if not set the current loaded raw content
151 * @throws XmlParserException If an XML error was found
153 function renderXmlContent ($content = NULL);
156 * Enables or disables language support
158 * @param $languageSupport New language support setting
161 function enableLanguageSupport ($languageSupport = TRUE);
164 * Checks whether language support is enabled
166 * @return $languageSupport Whether language support is enabled or disabled
168 function isLanguageSupportEnabled ();
171 * Enables or disables XML compacting
173 * @param $xmlCompacting New XML compacting setting
176 function enableXmlCompacting ($xmlCompacting = TRUE);
179 * Checks whether XML compacting is enabled
181 * @return $xmlCompacting Whether XML compacting is enabled or disabled
183 function isXmlCompactingEnabled ();
186 * Removes all comments, tabs and new-line charcters to compact the content
188 * @param $uncompactedContent The uncompacted content
189 * @return $compactedContent The compacted content
191 function compactContent ($uncompactedContent);