Zonet
Web Developer
Hey, here is my simple content display!
Usage:
etc ..
What do you think, is it a good way?
PHP:
<?PHP
class View
{
public $_show = null;
public function __construct( $subtopic, $_404 = 'not_found' )
{
if( file_exists( './pages/'.$subtopic.'.php' ) && isset( $subtopic ) )
{
$this->_show = './pages/'.$subtopic.'.php';
}
else
{
header( 'Location: ?subtopic='.$_404 );
}
}
public function display() {
require_once( $this->_show );
}
}
?>
Usage:
PHP:
<?PHP
echo $view->display();
?>
etc ..
What do you think, is it a good way?