<?php
$settings = array
(
array("Volvo",22,18),
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);
class page{
public function __construct(){
include("includes/header.php");
}
public function __destruct(){
include("includes/footer.php");
}
}
?>header.php ve footer.php içerisinde $settings yayınlamak istiyorum nasıl yapacağım?
Buyrun bir örnek hazirladim ;
Class page {
protected $settings=null;
/**
Build the __construct()
**/
public function __construct(array $settings)
{
$this->settings=$settings;
include("includes/header.php");
return null;
}
/**
Build the __destruct()
**/
public function __destruct()
{
include("includes/footer.php");
unset($this->settings);
return null;
}
}
$setup_settings=array(
array("Volvo",22,18),
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);
$page=new page($setup_settings);erismek icin ise $this->settings["dizi"] seklinde.