[pre-release] dev cms Website 

Status
Not open for further replies.
I've been pretty busy for the past week, but here's the new template class that'll I'll be using from now on. Basically I didn't like the fact that the template class (original) was using two classes and that there were functions inside the class that weren't needed etc.

PHP:
<?php
if (!defined('INDEX'))
{
	exit ('<h1>Access denied</h1><p>You do not have the privileges to access this webpage.</p>');
}

class template
{
	private $template = NULL;
	private $input = array ();
	private $output;

	public function template ($string)
	{
		$this->template = $string;
	}
	
	public function template_page ()
	{
		extract ($this->input);
		
		$input = ('resources/resources_private/private_template/template_private/'.$this->template.'.tpl');
		
		if (file_exists($input))
		{
			ob_start ();
			include ($input);
			$output = ob_get_contents ();
			ob_end_clean ();
			
			return $this->template_filter_input ($output);
		}
		else
		{
			exit ('<h1>Access denied</h1><p>Template ('.$this->template.') does not have the privileges to access this webpage.</p>');
		}
	}
	
	private function template_filter_input ($string)
	{
		foreach ($this->input as $input => $output)
		{
			if (is_object($output))
			{
				continue;
			}
			
			$string = str_ireplace ('%'.$input.'%', $output, $string);
		}
		
		return $string;
	}
	
	public function template_input ($input, $output)
	{
		$this->input[$input] = is_object ($output) ? $output->fetch () : $output;
	}
	
	public function template_output ()
	{
		$this->output .= $this->template_page ();
		echo $this->template_filter_input ($this->output);
	}
}
?>
 
Notice: Undefined index: p in C:\xampp2\htdocs\xabbo2\index.php on line 12

Notice: Undefined variable: result in C:\xampp2\htdocs\xabbo2\private\application\library\class.html.php on line 44

Notice: Undefined variable: result in C:\xampp2\htdocs\xabbo2\private\application\library\class.html.php on line 392

Notice: Undefined variable: errors in C:\xampp2\htdocs\xabbo2\private\application\theme\public\login.php on line 89

I get those errors, and can we please have the database file? prefer if its compatible with Butterstorm
 
Status
Not open for further replies.
Back