Changeset - 4e1fd8bb6784
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2010-10-27 19:41:53
ohnobinki@ohnopublishing.net
Some more whitespace for slightly cleaner HTML. Also set charset=utf8 in Content-Type as this is today's best-practice.
1 file changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -61,26 +61,28 @@ class page
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js" />';
 
    $this->headCode['displayTables'] = '<script type="text/javascript" src="scripts/displayTables.js" />';
 
    $this->pagetitle = $ntitle;
 
    $this->scripts = $nscripts;
 

	
 
   /* compliant browsers which care, such as gecko, explicitly request xhtml: */
 
   if(!empty($_SERVER['HTTP_ACCEPT'])
 
      && strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE
 
      || !strlen($_SERVER['HTTP_ACCEPT']) /* then the browser doesn't care :-) */)
 
     {
 
       $this->xhtml = TRUE;
 
       header('Content-type: application/xhtml+xml');
 
       header('Content-Type: application/xhtml+xml; charset=utf-8');
 
     }
 
   else
 
     header('Content-Type: text/html; charset=utf-8');
 

	
 
   if (count($ga_trackers))
 
     {
 
       $ga_www = 'http://www.';
 
       if ($_SERVER['SERVER_PORT'] != 80)
 
	 $ga_www = 'https://ssl.';
 

	
 
       $this->trackingcode = '<script type="text/javascript" src="' . $ga_www . 'google-analytics.com/ga.js" />' . "\n"
 
	 . $this->trackingcode
 
	 . '  <script type="text/javascript">' . "\n"
 
	 . '  ' . ($this->xhtml ? '<![CDATA[' : '') . "\n"
 
	 . "     var mytrackers = new Array();";
 
@@ -118,41 +120,45 @@ class page
 
   * \param $enable
 
   *   Whether or not to enable this code while adding it.
 
   */
 
  public function headcode_add($key, $code, $enable = FALSE)
 
  {
 
    $this->headCode[$key] = $code;
 
    if ($enable)
 
      $this->scripts[] = $key;
 
  }
 

	
 
// Public functions/vars
 

	
 
  public function head(){
 
  /**
 
   * \brief
 
   *   Output the HTML header for a page, including the <!DOCTYPE> and <head />
 
   */
 
  public function head()
 
  {
 
    $this->pageGenTime = round(microtime(), 3);
 

	
 
    if ($this->xhtml)
 
       echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
 

	
 
    echo '<!DOCTYPE ' . $this->doctype . '>
 
	  <html ' . $this->htmlargs . '>
 
	  <head>
 
	    <title>' . $this->pagetitle . ' :: ' . $this->base_title . '</title>
 
           <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8" />
 
	   <link rel="stylesheet" type="text/css" media="print" href="styles/print.css" />';
 

	
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $i){
 
    	echo $this->headCode["$i"];
 
    }
 
    foreach ($this->scripts as $i)
 
      echo '            ' . $this->headCode["$i"] . "\n";
 

	
 
    echo '</head>
 
	  <body '.$this->bodyargs.' ><div id="page">';
 
    echo $this->top(); // Write out top
 
  }
 

	
 
  private function top(){
 
    echo '<div id="header">
 

	
 
	    <div id="title">
 
              <h1><a href="index.php"><img src="images/slatepermutate.png" alt="SlatePermutate" class="noborder" /></a><br /></h1>
 
              <p><span id="subtitle">'.$this->pagetitle.'</span>
0 comments (0 inline, 0 general)