3 * extends the CMS preview - but should take the template from the builder..
4 * intended use is with the bootstrap code HTML generated..
7 require_once 'Pman/Cms/Preview.php';
9 class Pman_Builder_Preview extends Pman_Cms_Preview
13 function loadPage($prefix, $name, $default = false)
16 if (preg_match('/^BuilderJS/', $name)) {
17 $this->outputJS(preg_replace('#^BuilderJS/#','', $name));
20 //var_dump($name, $default);
21 //DB_DataObject::debugLevel(5);
22 parent::loadPage($prefix, $name, $default );
32 function outputJS($name)
34 $proj = HTML_FlexyFramework::get()->project;
35 // DB_DataObject::debugLevel(1);
36 $m = DB_DAtaObject::factory('Builder_modules');
37 $m->get('name', $proj );
38 $p = DB_DAtaObject::factory('Builder_part');
39 $p->module_id = $m->pid();
40 if (!$p->get('name', $name )) {
43 header('Content-type: text/javascript');
52 $proj = HTML_FlexyFramework::get()->project;
53 // DB_DataObject::debugLevel(1);
54 $m = DB_DAtaObject::factory('Builder_modules');
55 $m->get('name', $proj );
58 print_R($this->template);
59 // needs to modify the template directory??
60 // use the builder_module == app name
61 // look for part with same name.
62 $template_engine = new HTML_Template_Flexy(array(
63 'templateDir' => $m->path
65 $template_engine->compile($this->template);
66 if ($this->elements) { /* BC crap! */
67 $this->elements = HTML_Template_Flexy_Factory::setErrors($this->elements,$this->errors);
69 $template_engine->elements = $this->elements;
70 $template_engine->outputObject($this,$this->elements);