<?php
// Page class
class Page {
// Generates the top of the page
function addHeader($page,$title) {
$page.=<<<EOD
<html>
<head>
<title>$title</title>
</head>
<body>
<h1 align="center">$title</h1>
EOD;
return $page;
}
// Generates the bottom of the page
function addFooter($page,$year,$copyright) {
$page.=<<<EOD
<div align="center">© $year $copyright</div>
</body>
</html>
EOD;
return $page;
}
}
// Inicializar variable
$page='';
// Agregar encabezado de la pagina
$page = Page::addHeader($page,'A Script Using Static Methods');
// agregar cuerpo d ela pagina
$page.=<<<EOD
<p align="center">Esta pagia es generada por metodos de una clase</p>
EOD;
// Agregar pie de pagina
$page = Page::addFooter($page,date('Y'),'Static Designs Inc.');
// Display the page
echo ( $page );
?>
No hay comentarios:
Publicar un comentario