Total Pageviews

Wednesday, May 18, 2011

ITC 280 Classes/ Paging Class Notes 5-18-11


Review: assignment folders end on A7, everything is in your application folder (funky_fresh_test)
List/View: A8 is done indicator (link to your developing         Noun_List.php (plural)/noun_view.php (singular)
  Ex: Records_List.php

Demo folder – is the demolished version of the file (DO NOT put all your files in this folder)
Roots: Lowest Level of (horsey01, is the physical root server root)
public_html: web root on zephyr
Application root: web root (so index.php)
Class is a “blue print of an object”, represent an entire new world of how to program
            powerful applications use this, out of flow
(“property” is like a quality) – must caps the first letter of the class
  ex:
   
class Car
{
  public $color; //the color of the car
  public $mph; //the maximum speed (integer)
  public $price; //the price of the car, in dollars (float)
  public $model; //the model of the car

  function go($hours) (METHODS)
  {
    return ($this->mph * $hours); //returns miles traveled given time
  }
}
    Functions & Classes: both out of flow of the code
   Constructor Function: constructor allows us to set the ground rules for the creation of an object
     requires __ (two underscores)
      EX:
function __construct($model,$color,$price,$mph) //constructor function, w/o $ sign, it thinks it is a constant
   {
      $this->model = $model; //assigning data to properties via the constructor
      $this->color = $color;
      $this->price= $price;
      $this->mph= $mph;
   }
}
constructor is the parentheses of the class (how the stuff gets put into the class)
  in other classes (in C#, class name is class, can have only 1 constructor per class)
Object is an example of a class [in action”], but sometimes a class can be used separately from an object.
NOTE: name of the object needs to be generic, nothing specific
  $myCar = new Car();
  $myCar->color = "red"; 
In every other language, there is a period here (“My car ‘dot’ color”), period is concatenation
  $myCar->price = 60000;
  $myCar->model = "Ferrari";
  $myCar->mph = 140;
  echo "My " . $myCar->model . " can go " . $myCar->go(.5) . " in half an hour!";
  NOTE: in objects (assigning it to the property), use “->
                 in class (declaring properties), use “$
Paging: trick at the bottom of the page, to be able to go through multiple records
    Pager: # icon at the bottom the list page, that lets users navigate between the list pages
            designed for the “list” page, not the “view” page
         ex:
$myPager = new Pager(10);  --- how many number of records on a page
 $myPager = new Pager(20,'','<img src="images/arrow_prev.gif" border="0" />','<img src="images/arrow_next.gif" border="0" />','');
 ORDER: 1st, previous, next, last
Methods: Function within a class, used to manipulate the class properties and produce results, things that manipulate data… ( a term called, not a term used in the actual programming php language)
Properties: things that store pieces of data
Instantiation: is “creation”
Child Classes: born from the original, creating something sort of new but incorporates some of previous class
Encapsulation: “hiding” complex code in the class
autoload: will look for any number of pages for a particular name of a file

No comments:

Post a Comment