return $this->templateType;
}
- /**
- * Assign (add) a given variable with a value
- *
- * @param $variableName The variable we are looking for
- * @param $value The value we want to store in the variable
- * @return void
- * @throws EmptyVariableException If the variable name is left empty
- */
- public final function assignVariable ($variableName, $value) {
- // Replace all dashes to underscores to match variables with configuration entries
- $variableName = trim($this->convertDashesToUnderscores($variableName));
-
- // Empty variable found?
- if (empty($variableName)) {
- // Throw an exception
- throw new EmptyVariableException(array($this, 'variableName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } // END - if
-
- // First search for the variable if it was already added
- $index = $this->getVariableIndex($variableName);
-
- // Was it found?
- if ($index === FALSE) {
- // Add it to the stack
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
- $this->addVariable($variableName, $value);
- } elseif (!empty($value)) {
- // Modify the stack entry
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
- $this->modifyVariable($variableName, $value);
- }
- }
-
- /**
- * Removes a given variable
- *
- * @param $variableName The variable we are looking for
- * @param $variableGroup Name of variable group (default: 'general')
- * @return void
- */
- public final function removeVariable ($variableName, $variableGroup = 'general') {
- // First search for the variable if it was already added
- $index = $this->getVariableIndex($variableName, $variableGroup);
-
- // Was it found?
- if ($index !== FALSE) {
- // Remove this variable
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
- $this->unsetVariableStackOffset($index, $variableGroup);
- } // END - if
- }
-
/**
* Unsets the given offset in the variable group
*
$this->loadTemplate($template);
}
+ /**
+ * Assign (add) a given variable with a value
+ *
+ * @param $variableName The variable we are looking for
+ * @param $value The value we want to store in the variable
+ * @return void
+ * @throws EmptyVariableException If the variable name is left empty
+ */
+ public final function assignVariable ($variableName, $value) {
+ // Replace all dashes to underscores to match variables with configuration entries
+ $variableName = trim($this->convertDashesToUnderscores($variableName));
+
+ // Empty variable found?
+ if (empty($variableName)) {
+ // Throw an exception
+ throw new EmptyVariableException(array($this, 'variableName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } // END - if
+
+ // First search for the variable if it was already added
+ $index = $this->getVariableIndex($variableName);
+
+ // Was it found?
+ if ($index === FALSE) {
+ // Add it to the stack
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':ADD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+ $this->addVariable($variableName, $value);
+ } elseif (!empty($value)) {
+ // Modify the stack entry
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':MOD: ' . $variableName . '[' . gettype($value) . ']=' . $value);
+ $this->modifyVariable($variableName, $value);
+ }
+ }
+
+ /**
+ * Removes a given variable
+ *
+ * @param $variableName The variable we are looking for
+ * @param $variableGroup Name of variable group (default: 'general')
+ * @return void
+ */
+ public final function removeVariable ($variableName, $variableGroup = 'general') {
+ // First search for the variable if it was already added
+ $index = $this->getVariableIndex($variableName, $variableGroup);
+
+ // Was it found?
+ if ($index !== FALSE) {
+ // Remove this variable
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ':UNSET: variableGroup=' . $variableGroup . ',variableName=' . $variableName . ',index=' . $index);
+ $this->unsetVariableStackOffset($index, $variableGroup);
+ } // END - if
+ }
+
+ /**
+ * Assigns the last loaded raw template content with a given variable
+ *
+ * @param $templateName Name of the template we want to assign
+ * @param $variableName Name of the variable we want to assign
+ * @return void
+ */
+ public function assignTemplateWithVariable ($templateName, $variableName) {
+ // Get the content from last loaded raw template
+ $content = $this->getRawTemplateData();
+
+ // Assign the variable
+ $this->assignVariable($variableName, $content);
+
+ // Purge raw content
+ $this->setRawTemplateData('');
+ }
+
/**
* Assign a given congfiguration variable with a value
*
$this->setVariable('config', $variableName, $this->getConfigInstance()->getConfigEntry($variableName));
}
+ /**
+ * Assigns all the application data with template variables
+ *
+ * @param $applicationInstance A manageable application instance
+ * @return void
+ */
+ public function assignApplicationData (ManageableApplication $applicationInstance) {
+ // Get long name and assign it
+ $this->assignVariable('app_full_name' , $applicationInstance->getAppName());
+
+ // Get short name and assign it
+ $this->assignVariable('app_short_name', $applicationInstance->getAppShortName());
+
+ // Get version number and assign it
+ $this->assignVariable('app_version' , $applicationInstance->getAppVersion());
+
+ // Assign extra application-depending data
+ $applicationInstance->assignExtraTemplateData($this);
+ }
+
/**
* Load a specified code template into the engine
*
return $this->helpers[$helperName];
}
- /**
- * Assigns the last loaded raw template content with a given variable
- *
- * @param $templateName Name of the template we want to assign
- * @param $variableName Name of the variable we want to assign
- * @return void
- */
- public function assignTemplateWithVariable ($templateName, $variableName) {
- // Get the content from last loaded raw template
- $content = $this->getRawTemplateData();
-
- // Assign the variable
- $this->assignVariable($variableName, $content);
-
- // Purge raw content
- $this->setRawTemplateData('');
- }
-
/**
* Transfers the content of this template engine to a given response instance
*
$responseInstance->writeToBody($this->getCompiledData());
}
- /**
- * Assigns all the application data with template variables
- *
- * @param $applicationInstance A manageable application instance
- * @return void
- */
- public function assignApplicationData (ManageableApplication $applicationInstance) {
- // Get long name and assign it
- $this->assignVariable('app_full_name' , $applicationInstance->getAppName());
-
- // Get short name and assign it
- $this->assignVariable('app_short_name', $applicationInstance->getAppShortName());
-
- // Get version number and assign it
- $this->assignVariable('app_version' , $applicationInstance->getAppVersion());
-
- // Assign extra application-depending data
- $applicationInstance->assignExtraTemplateData($this);
- }
-
/**
* "Compiles" a variable by replacing {?var?} with it's content
*