* making the css and rss controllers work for real :D
[vsc.git] / _res / _libs / tscontrollerrss.class.php
blobb12126841d2386ff1d14d50797596ca6f718edc5
1 <?php
2 /**
3 * @name tsControllerRss
4 * @package RSS output class
5 */
7 class tsControllerRss extends tsControllerHtml {
8 public $db;
9 public function __construct(){
10 ob_start ();
11 $this->setTheme();
13 session_start();
15 $this->connectDb();
18 protected function connectDb () {
19 $this->db = sqlFactory::connect (DB_TYPE);
21 if (defined ('DB_NAME') && DB_NAME && !empty($this->db->link)) {
22 $this->db->selectDatabase(DB_NAME);
23 return true;
25 return false;
28 public function dispatch (){
29 $this->db->close();
30 $this->setTheme();
32 $this->smarty = new Smarty();
34 $this->smarty->compile_check = false;
35 // $this->smarty->debugging = C_SYSTEM_DEBUG;
36 $this->smarty->compile_dir = S_C_TEMPL_DIR;
38 if (is_file (PAGE_PATH . $className . DIRECTORY_SEPARATOR . $className . '.tpl')) {
39 $this->smarty->assign('contentFile', PAGE_PATH . $className . DIRECTORY_SEPARATOR . $className . '.tpl');
40 } else {
41 $this->smarty->assign('contentFile', $this->themePath . DIRECTORY_SEPARATOR . S_TEMPL_DIR . 'tpl404.tpl');
44 if (is_array($this->varArray)) {
45 $this->smarty->assign ($this->varArray);
47 $this->content = $this->smarty->fetch ($this->themePath . DIRECTORY_SEPARATOR . S_TEMPL_DIR . 'rss.tpl');
48 ob_end_clean();
49 $this->postDispatch ($this->content);
52 protected function postDispatch ($incString) {
53 header ('Content-Type: application/rss+xml');
54 echo str_replace(
55 array ('%TIME%','%QUERIES%', '%MEMUSED%'),
56 array (
57 number_format(microtime (true) - $GLOBALS['st'] , 5, ',', '.'),
58 $GLOBALS['qCnt'],
59 number_format(memory_get_usage()/1024, 3, ',', '.')
61 $incString