Radim inc fajl koji ce da generise HTML kod koji cu da uvozim sa funkcijom
require ();
to ce mi sluziti kao zadani izgled koji cu samo da uvozim u sripte da ne bi pravio zasebno...
problem je to sto mi pokazuje duplirani naziv menija... znaci imam meni
POCETNA | O NAMA | USLUGE | KONTAKT
a on meni na kraju kao rezultat ovako prikaze
pocetnaPOCETNA | o namaO NAMA | uslugeUSLUGE | kontaktKONTAKT
Sve ostalo radi fenomenalno bas kako sam zamislio samo eto meni malo koci!!!
<?php
class strana
{
// Dodela Atributa Klase (STRANA)
public $sadrzaj;
public $title = 'Ivan Stojmenovic';
public $keywords = 'Neodredjene kljucne reci jos uvek';
public $dugmici = array( 'pocetna' => 'pocetna.php',
'onama' => 'onama.php',
'usluge' => 'usluge.php',
'kontak' => 'kontakt.php'
);
// Pocetak Operacije Klase (STRANA)
public function __set($name, $value)
{
$this->$name = $value;
}
public function Prikazi()
{
echo "<html>\n<head>\n";
$this -> PrikaziTitle();
$this -> PrikaziKeywords();
$this -> PrikaziStyles();
echo "</head>\n<body>\n";
$this -> PrikaziHeader();
$this -> PrikaziMenu($this->dugmici);
echo $this->sadrzaj;
$this -> PrikaziFooter();
echo "</body>\n</html>\n";
}
public function PrikaziTitle()
{
echo '<title> '.$this->title.' </title>';
}
public function PrikaziKeywords()
{
echo "<meta name=\"keywords\" sadrzaj=\"$this->keywords\" />";
}
public function PrikaziStyles()
{
?>
<style>
h1 {color:black; font-size:24pt; text-align:center;
font-family:arial,sans-serif}
.menu {color:black; font-size:12pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold}
td {background:white}
p {color:black; font-size:12pt; text-align:justify;
font-family:arial,sans-serif}
p.foot {color:black; font-size:9pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold}
a:link,a:visited,a:active {color:black}
</style>
<?php
}
public function PrikaziHeader()
{
?>
<table width="100%" cellpadding ="12" cellspacing ="0" border ="0">
<tr bgcolor ="#000000">
<td align ="left"><img src = "logo.png" width="200" height="100" /></td>
<td>
<h1>Content Menagment Sistem</h1>
</td>
</tr>
</table>
<?php
}
public function PrikaziMenu($dugmici)
{
echo "<table width='100%' bgcolor='black' cellpadding='4'
cellspacing='4'\n";
echo " <tr>\n";
//Izracunaj velicinu dugmeta ($dugmici)
$width = 100/count($dugmici);
while (list($name, $url) = each($dugmici))
{
$this -> PrikaziButton($width, $name, $url, !$this->IsURLCurrentpage($url));
}
echo " </tr>\n";
echo "</table>\n";
}
public function IsURLCurrentpage($url)
{
if(strpos($_SERVER['PHP_SELF'], $url )==false)
{
return false;
}
else
{
return true;
}
}
public function PrikaziButton($width, $name, $url, $active = true)
{
if ($active)
{
echo "<td width ='$width%'>
<a href ='$url'>
<img src ='s-logo.gif' alt ='$name' border ='0' /></a>
<a href ='$url'><span class='menu'>$name</span></a></td>";
}
else
{
echo "<td width ='$width%'>
<img src ='side-logo.gif'>
<span class='menu'>$name</span></td>";
}
}
public function PrikaziFooter()
{
?>
<table width = "100%" bgcolor ="black" cellpadding ="12" border ="0">
<tr>
<td>
<p class="foot">© 2010. Ivan Stojmenovic</p>
</td>
</tr>
</table>
<?php
}
}
?>
|