array( 'Home','Oconbhup Central' ), 'prog'=>array( 'Prog','It's all about the 1s and 0s' ), 'lab'=>array( 'Labs','Science is fun in theory' ), 'links'=>array( 'Links','Interesting places on the internet' ), 'exams'=>array( 'Exams','All the info you might need (but is probably out of date by now)' ), 'about'=>array( 'About','Nothing really matters... but me.' ) ); if(!$_GET['p'] || !is_array($pages[$_GET['p']])) { $_GET['p'] = 'home'; } ######################## # # Databases # ######################## class infos { var $page; var $query; var $result; var $error; var $return; function infos() { $argv = func_get_args(); $this->page = $argv[0]; $this->populate_file(); #$this->populate_mysql(); } function populate_file() { /* be careful iterating over results from this, since the entry and column arrays are twice as long as they should be since they have both numerical and string keys for each entry, much like mysql would give. */ $file = file_get_contents('page/'.$this->page); $file = explode("\n##ENTRY##\n", $file); if($file[0] == NULL) { array_shift($file); } $entry_len=count($file); for($i=0; $i<$entry_len; $i++) { $file[$i] = explode("\n##COL##\n", $file[$i]); array_shift($file[$i]); $col_len=count($file[$i]); for($j=0; $j<$col_len; $j++) { $file_tmp = explode("\n##CONTENT##\n", $file[$i][$j]); $file[$i][$j] = $file_tmp[1]; $file[$i][$file_tmp[0]] = $file_tmp[1]; } $file[$file[$i]['uid']] = $file[$i]; } return $this->return=$file; } } ######################################## # # Standards Compliant Output # ######################################## /* I'll get around to writing an output for crappy browsers at some stage and keep a blacklist of browsers to redirect to that page. I find it easiest to store text to be output in a variable, and manipulate it or echo it straight out later. You could use something like ob_start and ob_end output buffering to edit your stream, but I'm lust a bit stuck in my ways, I guess. I have no idea which way is quicker tbh. */ $return .= ''."\n"; $return .= ''."\n"; $return .= '
'."\n"; $return .= ''."\n"; $return .= ''."\n"; $return .= ''."\n"; #FACEBOX LINKAGE $return .= ''."\n"; $return .= ''."\n"; $return .= ''."\n"; $return .= ''."\n"; $return .= '