}
+ function beforeUpdate($old, $q, $roo)
+ {
+ if (!empty($q['_rescan'])){
+ if ($this->filetype != 'html') {
+ $roo->jerr("can not update a php source file currently - TDOD");
+ }
+ $pg = HTML_FlexyFramework::get()->page;
+
+ $this->syncTemplatePage(array(
+ 'template_dir' => $pg->rootDir . '/'. str_replace('.', '/', $this->view_name). '/templates',
+ 'template' => $this->template,
+ 'base' => $this->view_name,
+ 'force' => true
+ ));
+ // update the different langage versions of this page.
+ $x = DB_Dataobject::Factory('core_templatestr');
+ $x->selectAdd();
+ $x->selectAdd('distinct(lang) as lang');
+ $x->whereAdd("lang != ''");
+ $langs = $x->fetchAll('lang');
+ foreach($langs as $l) {
+ $x = DB_Dataobject::Factory('core_templatestr');
+ $x->syncLang($l, $this->id);
+ }
+
+
+ $roo->jok("updated -" . $this->template);
+ }
+ }
+
+
+
+
/*
* @param base (should be full path to template directory)
* @param subdir = empty for top or subpath.
* @param template_dir << the path to the template dir ... Pman/XXX/template ...
* @param template << name of template used by name field)
* @param base << view name (module ? + templates?)
+ * @param force << optional - forces even if database is newer.
*
*
*/
ini_set('memory_limit', '512M');
//var_dump($n);
- $n= $pgdata['template']; // remove trailing slash..
+ $n = $pgdata['template']; // remove trailing slash..
$fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy;
$opts = HTML_FlexyFramework::get()->Pman_Core;
$tmpl->filetype = 'html';
$tmpl->update($oo);
}
-
-
-
- return $tmpl;
+ if (empty($pgdata['force'])) {
+ return $tmpl;
+ }
}
}
-
+ //die("got here");
try {
$r = $flexy->compile($pgdata['template']);
+
+
} catch(Exception $e) {
$old = clone($tmpl);
$tmpl->updated = date('Y-m-d H:i:s',filemtime($flexy->resolvePath ($pgdata['template'])));