+ // Write templates.
+ $templates = $this->getRecordsFromTable('tt_templates');
+ if (count($templates) > 0) {
+ fwrite($this->file, $this->indentation." <templates>\n");
+ foreach ($templates as $template) {
+ $template_part = $this->indentation.' '."<template name=\"".htmlspecialchars($template['name'])."\"";
+ $template_part .= " description=\"".htmlspecialchars($template['description'])."\"";
+ $template_part .= " content=\"".$this->encodeLineBreaks($template['content'])."\"";
+ $template_part .= " status=\"".$template['status']."\"";
+ $template_part .= "></template>\n";
+ fwrite($this->file, $template_part);
+ }
+ fwrite($this->file, $this->indentation." </templates>\n");
+ unset($templates);
+ unset($template_part);
+ }
+