site_name = 'Amazing website';
// HTML
$this->setHeaderFile();
$this->setFooterFile();
// SEO
$this->setTitle();
$this->setDescription();
$this->setRobots();
// CSS
$this->setStyle();
$this->setExtraStyle();
// JavaScript
$this->setBehaviour();
$this->setExtraBehaviour();
// Misc
$this->setCharset();
$this->setLanguage();
// id attribute for body tag used for user stylesheets/CSS
$this->body_id = str_replace('.','-',$_SERVER['HTTP_HOST']);
}
/* Methods */
// setHeaderFile
public function setHeaderFile(){
$this->header_file = $_SERVER['DOCUMENT_ROOT'].'/templates/header.php';
}
// setFooterFile
public function setFooterFile(){
$this->footer_file = $_SERVER['DOCUMENT_ROOT'].'/templates/footer.php';
}
// setTitle
public function setTitle($value = false){
// this value is ***so*** important for SEO
$this->title = ($value) ? $value : $this->site_name;
}
// setDescription
public function setDescription($value = false){
// set a META description (used as site description in Google) if it has been set on the view page
$this->description = ($value) ? ''."\n" : '';
}
// setRobots
public function setRobots($value = false){
// should a page be indexed or not?
$robots_value = (!$value) ? 'index,follow' : $value;
$this->robots = ''."\n";
}
// setStyle
public function setStyle($value = array()){
$value = (!$value) ? array() : $value;
$this->style_folder = '/style/';
// include default CSS that all pages must have
array_unshift($value, "reset", "global");
if(is_array($value)){
$this->style = ''."\n";
}
// IE7 fixes
$this->style .= ''."\n";
// IE6 fixes
$this->style .= ''."\n";
/*
SUGGESTED IMPROVEMENTS:
The CSS could be minified and/or chained together on the fly on the live server
to increase server performance and user experience
*/
}
// setExtraStyle
public function setExtraStyle($value = false){
// on page CSS - CSS is 100% specific to this individual page and doesn't
// warrant its own external stylesheet or to be in the global CSS
// value exists
if($value){
// create HTML
$this->extra_style = ''."\n";
}
// no value // no extra style
else{
$this->extra_style .= '';
}
// append extra style (if any) to the end
$this->style .= $this->extra_style;
}
// setBehaviour
public function setBehaviour($value = false){
// JavaScript of page: include at bottom of page in footer (just before