*/
private function insertAllTemplates (array $templateMatches) {
// Run through all loaded codes
- foreach ($this->loadedRawData as $template => $code) {
+ foreach ($this->loadedRawData as $template=>$code) {
// Search for the template
$foundIndex = array_search($template, $templateMatches[1]);
// Lookup the matching template replacement
- if (isset($templateMatches[0][$foundIndex])) {
+ if (($foundIndex !== false) && (isset($templateMatches[0][$foundIndex]))) {
// Get the current raw template
$rawData = $this->getRawTemplateData();
// Set the new raw data
$this->setRawTemplateData($rawData);
- }
- }
+
+ } // END - if
+
+ } // END - foreach
}
/**
if (count($this->loadedRawData) > 0) {
// Then compile all!
- foreach ($this->loadedRawData as $template => $code) {
+ foreach ($this->loadedRawData as $template=>$code) {
+
+ // Is this template already compiled?
+ if (in_array($template, $this->compiledTemplates)) {
+ // Then skip it
+ continue;
+ }
// Search for the template
$foundIndex = array_search($template, $templateMatches[1]);
// Lookup the matching variable data
- if (isset($templateMatches[3][$foundIndex])) {
+ if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) {
+
// Split it up with another reg. exp. into variable=value pairs
preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);