Formateo de página
En este ejemplo vamos a usar el PHP y la capacidad de definir librerÃas para conseguir que todas nuestras páginas tengan el mismo formato de página, incluyendo las partes comunes en librerÃas. Asà mismo modificando la librerÃa modificarÃamos tambien todas las páginas de una manera muy rápida.
libpagina.phtml
<!-- Manual de PHP de WebEstilo.com -->
<?php
   function CabeceraPagina()
   {
?>   <FONT SIZE="+1">Esta cabecera estará en todas sus páginas.</FONT><BR>
   <hr>
<?   }
  Â
   function PiePagina()
   {
?>Â Â Â Â Â Â <hr>
   <FONT SIZE="-1">Este es el pie de página.</FONT><BR>
   Autor: Joaquin Gracia
<?   }
  Â
   function Indice()
   {
?>Â Â Â <A HREF="ejem06a.phtml">Pagina 1</A><BR>
   <A HREF="ejem06a2.phtml">Pagina 2</A><BR>
<?   } ?>
ejem06a.phtml
<!-- Manual de PHP de WebEstilo.com -->
<html>
<head>
   <title>Ejemplo de PHP</title>
</head>
<body>
<?php include("libpagina.phtml") ?>
<?php CabeceraPagina(); ?>
<TABLE>
<TR>
   <TD><?php Indice() ?></TD>
   <TD>
         Esta es otra página<BR><BR>
         completamente distinta<BR><BR>
         pero comparte el pie y la cabecera con la otra.<BR><BR>
   </TD>
</TR>
</TABLE>
<?php PiePagina(); ?>
</body>
</html>
ejem06a2.phtml
<!-- Manual de PHP de WebEstilo.com -->
<html>
<head>
   <title>Ejemplo de PHP</title>
</head>
<body>
<?php include("libpagina.phtml") ?>
<?php CabeceraPagina(); ?>
<TABLE>
<TR>
   <TD><?php Indice() ?></TD>
   <TD>
Página 1
<BR><BR><BR><BR><BR>
Contenido blalbl blalb alb<BR><BR>
más cosas...<BR><BR>
fin<BR><BR>
   </TD>
</TR>
</TABLE>
<?php PiePagina(); ?>
</body>
</html>