function loadPage($prefix, $name, $default = false)
{
+
+ if (preg_match('/^BuilderJS/', $name)) {
+ $this->outputJS(preg_replace('#^BuilderJS/#','', $name));
+
+ }
//var_dump($name, $default);
//DB_DataObject::debugLevel(5);
parent::loadPage($prefix, $name, $default );
}
+ function outputJS($name)
+ {
+ $proj = HTML_FlexyFramework::get()->project;
+ // DB_DataObject::debugLevel(1);
+ $m = DB_DAtaObject::factory('Builder_modules');
+ $m->get('name', $proj );
+ $p = DB_DAtaObject::factory('Builder_part');
+ $p->module_id = $m->pid();
+ if (!$p->get('name', $name )) {
+ die("invalid url");
+ }
+ header('Content-type: text/javascript');
+ // this should outpt the file if it's found.
+ if (file_exists($m->path . '/'. $p->name .'.js')) {
+ $fh = fopen($m->path . '/'. $p->name .'.js', 'r');
+ fpassthru($fh);
+ exit;
+ }
+
+ echo $p->jsource;
+ exit;
+ }
+
function outputBody()
{
- $oo = HTML_FlexyFramework::get()->Pman_Cms;
- $template_prefix = isset($oo['template_prefix']) ? $oo['template_prefix'] : '';
-
- $m = DB_DAtaObject::Factory('Builder_modules');
- $m->get('name', $template_prefix);
+ if ($this->timer) {
+ $this->timer->setMarker(__CLASS__ . '::outputBody - start');
+ }
+ $ff = HTML_FlexyFramework::get();
+
+ $proj = $ff->project;
+ // DB_DataObject::debugLevel(1);
+ $m = DB_DAtaObject::factory('Builder_modules');
+ $m->get('name', $proj );
+
+ //var_dump($m->path);exit;
// needs to modify the template directory??
// use the builder_module == app name
// look for part with same name.
- $template_engine = new HTML_Template_Flexy(array(
- 'template_dir' => $m->path
- ));
+ if (empty($ff->Pman_Builder['from_filesystem'])) {
+
+ $template_engine = new HTML_Template_Flexy(array(
+ 'templateDir' => $m->path
+ ));
+ } else {
+ $template_engine = new HTML_Template_Flexy();
+ }
+
+ $template_engine->debug = 1;
+ //print_R($template_engine);
+
$template_engine->compile($this->template);
if ($this->elements) { /* BC crap! */
$this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements,$this->errors);
}
$template_engine->elements = $this->elements;
+ if ($this->timer) {
+ $this->timer->setMarker(__CLASS__ . '::outputBody - render template');
+ }
+ //DB_DataObject::debugLevel(1);
$template_engine->outputObject($this,$this->elements);
-
+ if ($this->timer) {
+ $this->timer->setMarker(__CLASS__ . '::outputBody - end');
+ }
}
}
\ No newline at end of file