stvarno mi nije jasna ova stvar
Code:
<?php
class Page{
//atributi klase Page;
public $content;
public $title='TLA Consulting Pty Ltd';
public $keywords='TLA Consulting, Three Letter Abbreviation some of my best friends are search endiges';
public $buttons=array('Home' => 'home.php',
'Contact' => 'contact.php',
'Services' => 'services.php',
'Site Map' => 'map.php');
public $bt=array('23','2321','4');
public function Display(){
echo "<html>\n <head>\n" ;
//echo "Velicina niza ".count($this->buttons)."\n";
//echo "Velicina niza ".count($this->bt)."\n";
$this->DisplayTitle();
$this->DisplayKeywords();
$this->DisplayStyles();
echo "</head>\n<body>";
$this->DisplayHeader();
$this->DisplayMenu($buttons);
echo "</body> \n </html>";
}
public function __set($name,$value){
$this->$name=$value;
}
public function DisplayTitle(){
echo '<title>'.$this->title.'</title>';
}
public function DisplayKeywords(){
echo "<meta name=\"keewords\" content=\"".htmlentities($this->keywords)."\" />";
}
public function DisplayStyles(){
?>
<style>
<!--
td{background:black}
p{color:black; font-size:12pt; text-aligne:justify; font-family:arial;,sans-serif}
p.foot{color:white; font-size:9pt; text-aligne:center; font-family: arial, sans-serif}
a:link, a:visited, a:active{color:white}
-->
</style>
<?php
}
public function DisplayHeader(){
?>
<table width"100" cellpadding="12" cellspacing="0" border="0">
<tr bgcolor="black">
<td aligne="left"> <img src="slk/logo.gif"> </td>
<td>
<h1> TLA Consulting Pty Ltd <h1>
</td>
<td aligne="right" > <img src="slk/logo.gif"> </td>
</tr>
</table>
<?php
}
public function DisplayMenu($buttons){
echo "<table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'";
echo "<tr>\n";
//izracunavanje velicine dugmeta
$width=100/count($this->buttons);
foreach ($this->buttons as $name=>$url)
$this-> DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
echo "</tr>\n";
echo "</table>\n";
}
public function IsURLCurrentPage($url){
echo 'Urls='.$url.'';
if(strpos($_SERVER['PHP_SELF'],$url)==false){
return false;
}
else{
return true;
}
}
public function DisplayButton($width, $name, $url, $active=true){
if($active)
{
echo "<td width='".htmlentities($width)."%'>
<a href='".htmlentities($url)."'>
<img src='slk/s-log.gif' alt='".htmlentities($name)."' border='0'></a>
<a href='".htmlentities($url)."'> <span class='menu'>$name</span></a></td>";
}
else{
echo "<td width='".htmlentities($width)."%')>
<img src='slk/side-logo.gif'>
<span class='menu'> $name</span> </td>";
}
}
public function DysplayFooter(){
?>
<table width="100%" bgcolor="black" cellpadding="12" border="0">
<tr>
<td>
<p class="foot"> © TLA Consulting Pty Ltd. </p>
<p class="foot"> Please see our <a href="legal.php"> legal information page,</a> </p>
</td>
</tr>
</table>
<?php
}
}
?>
<?php
class Page{
//atributi klase Page;
public $content;
public $title='TLA Consulting Pty Ltd';
public $keywords='TLA Consulting, Three Letter Abbreviation some of my best friends are search endiges';
public $buttons=array('Home' => 'home.php',
'Contact' => 'contact.php',
'Services' => 'services.php',
'Site Map' => 'map.php');
public $bt=array('23','2321','4');
public function Display(){
echo "<html>\n <head>\n" ;
//echo "Velicina niza ".count($this->buttons)."\n";
//echo "Velicina niza ".count($this->bt)."\n";
$this->DisplayTitle();
$this->DisplayKeywords();
$this->DisplayStyles();
echo "</head>\n<body>";
$this->DisplayHeader();
$this->DisplayMenu($buttons);
echo "</body> \n </html>";
}
public function __set($name,$value){
$this->$name=$value;
}
public function DisplayTitle(){
echo '<title>'.$this->title.'</title>';
}
public function DisplayKeywords(){
echo "<meta name=\"keewords\" content=\"".htmlentities($this->keywords)."\" />";
}
public function DisplayStyles(){
?>
<style>
<!--
td{background:black}
p{color:black; font-size:12pt; text-aligne:justify; font-family:arial;,sans-serif}
p.foot{color:white; font-size:9pt; text-aligne:center; font-family: arial, sans-serif}
a:link, a:visited, a:active{color:white}
-->
</style>
<?php
}
public function DisplayHeader(){
?>
<table width"100" cellpadding="12" cellspacing="0" border="0">
<tr bgcolor="black">
<td aligne="left"> <img src="slk/logo.gif"> </td>
<td>
<h1> TLA Consulting Pty Ltd <h1>
</td>
<td aligne="right" > <img src="slk/logo.gif"> </td>
</tr>
</table>
<?php
}
public function DisplayMenu($buttons){
echo "<table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'";
echo "<tr>\n";
//izracunavanje velicine dugmeta
$width=100/count($this->buttons);
foreach ($this->buttons as $name=>$url)
$this-> DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
echo "</tr>\n";
echo "</table>\n";
}
public function IsURLCurrentPage($url){
echo 'Urls='.$url.'';
if(strpos($_SERVER['PHP_SELF'],$url)==false){
return false;
}
else{
return true;
}
}
public function DisplayButton($width, $name, $url, $active=true){
if($active)
{
echo "<td width='".htmlentities($width)."%'>
<a href='".htmlentities($url)."'>
<img src='slk/s-log.gif' alt='".htmlentities($name)."' border='0'></a>
<a href='".htmlentities($url)."'> <span class='menu'>$name</span></a></td>";
}
else{
echo "<td width='".htmlentities($width)."%')>
<img src='slk/side-logo.gif'>
<span class='menu'> $name</span> </td>";
}
}
public function DysplayFooter(){
?>
<table width="100%" bgcolor="black" cellpadding="12" border="0">
<tr>
<td>
<p class="foot"> © TLA Consulting Pty Ltd. </p>
<p class="foot"> Please see our <a href="legal.php"> legal information page,</a> </p>
</td>
</tr>
</table>
<?php
}
}
?>
eevo i koda iz koje pozivam klasu Page i medotu Display()
Code:
<?php
require('Page.php');
$pg=new Page();
$pg->Display();
?>
<?php
require('Page.php');
$pg=new Page();
$pg->Display();
?>