= 3, class.page.php @author Chris Fordham @copyright Chris Fordham 2006 @website http://xhost.com.au */ // include the base simple page framework class require_once('../include/classes/class.page.php'); // Create a Page object $page = new Page; // include the site configuration file (flat file data source, php variables) require_once(dirname($_SERVER['SCRIPT_FILENAME']).'/include/config/site-admin.conf'); // load required classes (TBS, iGallery) $page->loadClass('class.tbs3-php4.php'); $page->trace('All classes loaded'); // creat the template engine object (TBS) $tbs = new clsTinyButStrong ; // default - set the content to the index page content file $page->content = $page->getPageContent('page_editor'); if (!empty($_GET['action']) && isset($_GET['action'])) { $action = strtolower($_GET['action']); } else { if (!empty($_POST['action']) && isset($_POST['action'])) { $action = strtolower($_POST['action']); } else { $action = null; } } if (!empty($_GET['page_name']) && isset($_GET['page_name'])) { $pageName = strtolower($_GET['page_name']); } else { if (!empty($_POST['page_name']) && isset($_POST['page_name'])) { $action = strtolower($_POST['page_name']); } else { $pageName = null; } } $page->trace('value: $action : '."$action"); $page->trace('value: $pageName : '.$pageName); if (!empty($action) && $pageName) { switch ($action) { case 'edit': $pageName = $_GET['page_name']; $page->page_conf['template'] = $page->site_conf['template_path'].'/template_editor.html'; $page->page_conf['sub_template'] = $page->site_conf['subtemplate_path'].'/subtpl_page_editor-edit.inc'; $pageContent = $page->getFlatFileContent($page->site_conf['pages_path-editor']."/page_$pageName.html"); // $page->trace("data: $pageContent"); // load the default template $tbs->LoadTemplate($page->page_conf['template']); $page->trace('default template loaded'); break; } } else { if (is_dir($page->site_conf['pages_path-editor'])) { $dh = opendir($page->site_conf['pages_path-editor']); while (false !== ($filename = readdir($dh))) { if ($filename != '.' && $filename != '..') { $files[]['page_name'] = str_replace('.html', '', str_replace('page_', '', $filename)); } } // set the template and subtemplates, finally load the template $page->page_conf['template'] = $page->site_conf['template_path'].'/template_subtpl.html'; $page->page_conf['sub_template'] = $page->site_conf['subtemplate_path'].'/subtpl_page_editor-list.inc'; $tbs->LoadTemplate($page->page_conf['template']); $page->trace('subtpl template loaded'); // merge file list $tbs->MergeBlock('data_pages', $files) ; $page->trace('data: '.print_r($files, true)); } else { $page->error('The $page->site_conf[\'pages_path-editor\'] directory '.$page->site_conf['pages_path-editor'].' does not exist or is not readable'); } } // load the page $page->load(); // show the TE output $tbs->Show(); ?>