function CarDealer(){
parent::Company();
}
function setWhichPage(){
if ($_GET['whichpage']=='sales')
$whichpage=sales;
else if ($_GET['whichpage']=='support')
$whichpage=support;
else if ($_GET['whichpage']=='contact')
$whichpage=contact;
else
$whichpage=home;
}//end of setWhichPage()
function getMainSection(){
global $whichpage;
return "
The ".$whichpage." Page
";
}
function getLeftNavBar($array){
$tableNav;
$tableNav = '';
$tableNav .= "";
$tableNav .= "| Home Page | ";
$tableNav .= "
";
$tableNav .= "";
$tableNav .= "| Sales | ";
$tableNav .= "
";
$tableNav .= "";
$tableNav .= "| Support | ";
$tableNav .= "
";
$tableNav .= "";
$tableNav .= "| Contacts | ";
$tableNav .= "
";
$tableNav .= "
";
return $tableNav;
}
# create array for a Car/house/travel Nav Bar
function create_navbar_array ( ) {
$mainurl = $this->company_url; // get the main url address of this web page
$this->navbar_array = array( "Home Page"=>"$mainurl?whichpage=home", "Sales"=>"$mainurl?whichpage=sales",
"Support" => "$mainurl?whichpage=support", "Contacts" => "$mainurl?whichpage=contact" );
}
}// end of CarDealer Class
class Company {
var $company_name = "O-dogg's Exotic Cars";
var $company_address = "12345 Valencia Blvd";
var $company_citystatezip = "Valencia, CA 91355";
var $car_array;
var $whichpage="home";
function Company(){
}
function display_company_name($text){
print "$text
";
} // end of display_company_name
function display_company_address(){
global $company_name;
global $company_address;
global $company_citystatezip;
print "
".$company_name."";
print "
".$company_address."";
print "
".$company_citystatezip."";
} //end of display_company_address
# create array for a Car Dealership
function create_array_cars ( ) {
global $car_array;
$car_array = array();
$car_array[] = array( "12345", "2002 Ford Ranger", "6500.00", "Excellent condition, low 68000 miles" );
$car_array[] = array( "45678", "1998 Chevy Corvette", "19995.00", "Low miles 54000, Great car 4 cruising" );
$car_array[] = array( "67890", "2000 Toyota Camry", "9990.00", "Mom wants you 2 buy a conservative car" );
$car_array[] = array( "89123", "1995 Honda Civic", "4500.00", "140000 miles, but a Honda, it will last" );
}
function displayProduct($c_array){
print '';
print "";
print "| Item Number | ";
print "Car | ";
print "Price | ";
print "Comments | ";
print "
";
for ($i=0;$i";
for ($j=0;$j".$c_array[$i][$j]."";
}
print "";
}
print "
";
}
function getHeader($company_name, $color){
$data = "";
$data .= "".$company_name."";
$data = $data . " |
";
return $data;
}
function getFooter($color){
global $company_name;
global $company_address;
global $company_citystatezip;
$data = "";
$data .= "| ".$company_name." |
";
$data .= "| ".$company_address." |
";
$data .= "| ".$company_citystatezip." |
";
$data = $data . "
";
return $data;
}
} // end class company
$carobject2 = new CarDealer();
$carobject2->create_navbar_array();
print $carobject2->getLeftNavBar($carobject2->$navbar_array);
$carobject2->setWhichPage();
print $carobject2->getMainSection();