Origins

Since 1998 I have involved myself in the web development process. It started with creating a simple fansite for a game, granted my knowledge was very limited at the time. I was a creator of your typical "1995 style" web sites. When I was introduced to CSS and PHP my web development life changed forever. From then until now, I have made vast improvements on my web development process and techniques. This site is a living version of my knowledge, constantly updated and constantly redesigned, implementing the newest technologies as I learn them.

PHP

Without knowing the value of both of these languages, the limits of what can be done are limited. Opening up to the possibilities of infinite solutions opens the doors of the server sided programming world. Over the years of programming with PHP I have come to a realization that there really can never not be a solution for any kind of problem. I have learned from experiences where I have been told that something is impossible to do, that there is infact a way to do the "Impossible."

Object Oriented Programming

Object oriented programming techniques are the focal points of my long and short term goals. The ability to properly create and manipulate any piece of object oriented code makes the developer that much more powerful. Creating tools that can be used on the fly, import scripts into pages without having to alter any of the original code. Who wouldn't want to be armed with a code library defined and custom tailored to their style yet flexble enough to accomodate the needs of the client?

Code Samples

Below showcases a few code samples that demonstrate my particular style of programming. The functions that are displayed are currently used throughout the site. To view the live demonstrations, follow any of the following links to the corresponding section.



  • Function: getSection():   Every page utilizes this function.
  • Function: getImages():    Organizes and sets the display for images.
  • Function: buildMessage(): Notifies the user of any error messages or success messages.
  • Function: groom():        Grooms the input fields to allow or disallow specific characters.

<?php
  function getSection()
  {
      $url = explode("/", $_GET['q']);
      $section = end($url);
      if ($section == "") {
          $count = count($url);
          $section = $url[$count - 2];
          if ($section == "") {
              $section = "home";
          }
      }
      return $section;
  }
  
  
  function getImages($table, $order)
  {
      $query = mysql_query("SELECT * FROM `" . $table . "` order by `id` " . $order . "");
      $int = 0;
      $count = mysql_num_rows($query);
      $this->images = "<table class=\"photo\">";
      while ($images = mysql_fetch_array($query)) {
          if ($int % 4 == 0) {
              $this->images .= "<tr>\r\n";
          }
          $this->images .= "\t\t<td align=\"center\" class=\"image\"";
          $this->images .= "id=\"" . str_replace("'", "", str_replace(" ", "", $images['filename']));
          $this->images .= "\"><script type=\"text/javascript\">loadImages('";
          $this->images .= $images['filetype'] . "', '";
          $this->images .= str_replace("'", "", str_replace(" ", "", $images['filename']));
          $this->images .= "', '" . $images['id'] . "');</script><a href=\"/images/";
          $this->images .= $images['id'] . $images['filetype'] . "\" class=\"lightwindow imgLink\"";
          $this->images .= "rel=\"Images[Artwork]\" ><img src=\"/images/overlay.png\"";
          $this->images .= "border=\"0\" alt=\"" . $images['filename'] . "\" /></a></td>\r\n";
          
          if ($int % 4 == 3 || $int == $count - 1) {
              $this->images .= "</tr>\r\n";
          }
          $int++;
      }
      $this->images .= "</table>";
      return $this->images;
  }
  
  
  function buildMessage($message)
  {
      if (is_array($message)) {
          $this->messageReturn = "<ul class=\"error\">";
          foreach ($message as $key => $value) {
              $this->messageReturn .= "<li>" . $value . "</li>";
          }
          $this->messageReturn .= "</ul>";
      } else {
          
          $this->messageReturn = "<ul class=\"message\"><li>" . $message . "</li></ul>";
      }
      return $this->messageReturn;
  }
  
  function groom($groomed, $ad, $except)
  {
      $breakAllow = explode(" ", $except);
      if ($ad == "a") {
          $allow = "/[^a-z\\040";
      } else {
          
          $allow = "/[^a-z0-9\\040";
      }
      foreach ($breakAllow as $key => $value) {
          $allow .= "\\$value";
      }
      $allow .= "]/i";
      
      switch ($ad) {
          case "a":
              $groomed = preg_replace($allow, "", $groomed);
              break;
          case "ad":
              $groomed = preg_replace($allow, "", $groomed);
              break;
      }
      return $groomed;
  }
?>