title: Error message Strict standards: Non-static method should not be called statically in php
body: <p>I have the following php. However when I see the index.php I get the following error message. </p>
  
  <blockquote>
    <p>Strict standards: Non-static method
    Page::getInstanceByName() should not
    be called statically in
    /var/www/webworks/index.php on line 12</p>
  </blockquote>
  
  <p>I am hoping someone can tell me how to fix the problem.</p>
  
  <p>index.php</p>
  
  <pre><code>// { common variables and functions
  include_once('ww.incs/common.php');
  $page=isset($_REQUEST['page'])?$_REQUEST['page']:'';
  $id=isset($_REQUEST['id'])?(int)$_REQUEST['id']:0;
  ...
  
  // { get current page id
  if(!$id){
      if($page){ // load by name
          $r=Page::getInstanceByName($page);
          if($r &amp;&amp; isset($r-&gt;id))$id=$r-&gt;id;
      }
      if(!$id){ // else load by special
          $special=1;
          if(!$page){
              $r=Page::getInstanceBySpecial($special);
              if($r &amp;&amp; isset($r-&gt;id))$id=$r-&gt;id;
          }
      }
  }
  
  // { load page data
  if($id){
      $PAGEDATA=(isset($r) &amp;&amp; $r)?$r : Page::getInstance($id);
  }
  else{
      echo '404 thing goes here';
      exit;
  }
  ...
  ...
  </code></pre>
  
  <p>ww.incs/common.php</p>
  
  <pre><code>&lt;?php
  require dirname(__FILE__).'/basics.php';
  ...
  ...
  </code></pre>
  
  <p>ww.incs/basics.php</p>
  
  <pre><code>session_start();
  if(!function_exists('__autoload')){
      function __autoload($name) {
          require $name . '.php';
      }
  }
  ...
  ...
  </code></pre>
  
  <p>Page.php</p>
  
  <pre><code>class Page{
      static $instances             = array();
      static $instancesByName     = array();
      static $instancesBySpecial   = array();
      function __construct($v,$byField=0,$fromRow=0,$pvq=0){
          # byField: 0=ID; 1=Name; 3=special
          if (!$byField &amp;&amp; is_numeric($v)){ // by ID
              $r=$fromRow?$fromRow:($v?dbRow("select * from pages where id=$v limit 1"):array());
          }
          else if ($byField == 1){ // by name
              $name=strtolower(str_replace('-','_',$v));
              $fname='page_by_name_'.md5($name);
              $r=dbRow("select * from pages where name like '".addslashes($name)."' limit 1");
          }
          else if ($byField == 3 &amp;&amp; is_numeric($v)){ // by special
              $fname='page_by_special_'.$v;
              $r=dbRow("select * from pages where special&amp;$v limit 1");
          }
          else return false;
          if(!count($r || !is_array($r)))return false;
          if(!isset($r['id']))$r['id']=0;
          if(!isset($r['type']))$r['type']=0;
          if(!isset($r['special']))$r['special']=0;
          if(!isset($r['name']))$r['name']='NO NAME SUPPLIED';
          foreach ($r as $k=&gt;$v) $this-&gt;{$k}=$v;
          $this-&gt;urlname=$r['name'];
          $this-&gt;dbVals=$r;
          self::$instances[$this-&gt;id] =&amp; $this;
          self::$instancesByName[preg_replace('/[^a-z0-9]/','-',strtolower($this-&gt;urlname))] =&amp; $this;
          self::$instancesBySpecial[$this-&gt;special] =&amp; $this;
          if(!$this-&gt;vars)$this-&gt;vars='{}';
          $this-&gt;vars=json_decode($this-&gt;vars);
      }
      function getInstance($id=0,$fromRow=false,$pvq=false){
          if (!is_numeric($id)) return false;
          if (!@array_key_exists($id,self::$instances)) self::$instances[$id]=new Page($id,0,$fromRow,$pvq);
          return self::$instances[$id];
      }
      function getInstanceByName($name=''){
          $name=strtolower($name);
          $nameIndex=preg_replace('#[^a-z0-9/]#','-',$name);
          if(@array_key_exists($nameIndex,self::$instancesByName))return self::$instancesByName[$nameIndex];
          self::$instancesByName[$nameIndex]=new Page($name,1);
          return self::$instancesByName[$nameIndex];
      }
      function getInstanceBySpecial($sp=0){
          if (!is_numeric($sp)) return false;
          if (!@array_key_exists($sp,$instancesBySpecial)) $instancesBySpecial[$sp]=new Page($sp,3);
          return $instancesBySpecial[$sp];
      }
  </code></pre>