slaine
24-11-2005, 15:54
hail.
Вот есть такой скрипт шаблона.
page.inc.
class page
{
var $title;
var $keywords;
var $content;
var $links = array( "index" => "index.php",
"contacts" => "contacts.php",
"download" => "download.php"
);
function settitle($newtitle){
$this->title = $newtitle;
}
function setkeywords($newkeywords){
$this->keywords = $newkeywords;
}
function setcontent($newcontent){
$this->content = $newcontent;
}
function Display(){
echo "<html><head>";
echo "<title> $this->title </title>";
echo "<META content='text/html; charset=windows-1251' http-equiv=Content-Type>";
echo $this->keywords;
echo "<style>
A:link {color: #666666; text-decoration: underline; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
A:visited {color: #666666; text-decoration: underline; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
A:hover {color: orangered; text-decoration: none; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
</style>";
echo "</head><body>";
$this -> DisplayMenu($this->links);
echo $this->content;
echo "</body></html>";
}
function DisplayMenu($links){
echo "<table width = 100% bgcolor=#ffffff cellpadding = 4 cellspacing = 0>
<colgroup align=center>
<tr>";
$width = 100/count($links);
foreach ($links as $name => $url){
$this->DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
}
echo " </tr>
</table>";
}
function IsURLCurrentPage($url){
if(strpos( $_SERVER['PHP_SELF'], $url ) == false){
return false;
} else {
return true;
}
}
function DisplayButton($width, $name, $url, $active = true){
if ($active)
{
echo "<td width = ".$width."%>
<a href = ".$url."><span>".$name."</span></a></td>";
} else {
echo "<td width = ".$width."%>
<span><B>".$name."</B></span></td>";
}
}
}
В свою очередь index.php:
require ("page.inc");
$homepage = new Page();
$homepage -> settitle("news");
$homepage -> setkeywords("<META content='' name=keywords>");
$homepage -> setcontent("<CENTER><H1>НОВОСТИ</H1><CENTER>");
$homepage -> Display();
Скажите, как можно к этому срипту(page.inc) прикрутить какой-нибудь скрипт, например: guest book?
Вот есть такой скрипт шаблона.
page.inc.
class page
{
var $title;
var $keywords;
var $content;
var $links = array( "index" => "index.php",
"contacts" => "contacts.php",
"download" => "download.php"
);
function settitle($newtitle){
$this->title = $newtitle;
}
function setkeywords($newkeywords){
$this->keywords = $newkeywords;
}
function setcontent($newcontent){
$this->content = $newcontent;
}
function Display(){
echo "<html><head>";
echo "<title> $this->title </title>";
echo "<META content='text/html; charset=windows-1251' http-equiv=Content-Type>";
echo $this->keywords;
echo "<style>
A:link {color: #666666; text-decoration: underline; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
A:visited {color: #666666; text-decoration: underline; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
A:hover {color: orangered; text-decoration: none; font-family: arial, helvetiva; font-size: 11px; font-weight: normal};
</style>";
echo "</head><body>";
$this -> DisplayMenu($this->links);
echo $this->content;
echo "</body></html>";
}
function DisplayMenu($links){
echo "<table width = 100% bgcolor=#ffffff cellpadding = 4 cellspacing = 0>
<colgroup align=center>
<tr>";
$width = 100/count($links);
foreach ($links as $name => $url){
$this->DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
}
echo " </tr>
</table>";
}
function IsURLCurrentPage($url){
if(strpos( $_SERVER['PHP_SELF'], $url ) == false){
return false;
} else {
return true;
}
}
function DisplayButton($width, $name, $url, $active = true){
if ($active)
{
echo "<td width = ".$width."%>
<a href = ".$url."><span>".$name."</span></a></td>";
} else {
echo "<td width = ".$width."%>
<span><B>".$name."</B></span></td>";
}
}
}
В свою очередь index.php:
require ("page.inc");
$homepage = new Page();
$homepage -> settitle("news");
$homepage -> setkeywords("<META content='' name=keywords>");
$homepage -> setcontent("<CENTER><H1>НОВОСТИ</H1><CENTER>");
$homepage -> Display();
Скажите, как можно к этому срипту(page.inc) прикрутить какой-нибудь скрипт, например: guest book?