On Sun, 29 Aug 2004 19:36:49 -0400, John Nichel <[EMAIL PROTECTED]> wrote:
> Francisco Javier Escoppinichi Fernández wrote:
> > Hello people...
> >
> > I have a little problem here... I hope you can help me...
> >
> > I'm building a simple template system for a web site, and I created
> > some "tags" in a .html file that I read using the file_get_contents()
> > function. The "tags" I created are something like {menu}, {date},
> > {user}, etc.
> >
> > Well, the problem shows up when I use the function
> > str_replace("{menu}", $var_with_some_menu_links,  $html_contents).
> > Nothings happen and when I output the template contents, I see the
> > tags, in other words, nothing gets replaced.
> >
> > Any ideas on what I'm doing wrong?
> >
> > Thank you very much in advance for your help.
> 
> Show the code which isn't working.

Here it goes:

<class.interior.php>
class Interior
{
        var $html;
        var $menuLateral;
        var $buffer;
        var $titulo;

        function Interior() // Constructor. Construyo el menú y demás.
        {
                $this->html = file_get_contents('plantillas/interior.html'); //
Plantilla interior.
                //$this->menuLateral =
file_get_contents('plantillas/menulateral.html'); // Bloque menu
lateral.
                $this->buffer = '';
        }
        
        function Salida($output) // Agrega cosas a la interfaz de salida.
        {
                $this->buffer .= $output;
        }
        
        function Show() // This function outputs the final HTML. It's called
by another module.
        {
                str_replace("{contenido}", $this->buffer, $this->html);
                str_replace("{tituloSeccion}", $this->titulo, $this->html);
                echo $this->html;
        }
        
        function Titulo($str)
        {
                $this->titulo = $str;
        }
        
        function Clear() // Elimino toda la salida y la dejo en blanco.
        {
                $this->buffer = '';
        }

}
</class.interior.php>

<the html file>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Instituto Tecnol&oacute;gico de La Paz - {tituloSeccion}</title>
<style type="text/css">
<!--
.center {
        margin-right: auto;
        margin-left: auto;
        width: 779px;
        border: 1px solid #000000;
        clear: both;
        display: table;
}

h2 {
    visibility: hidden;
}
.bg {
        background-repeat: repeat-x;
        background-position: top;
        background-image: url(/img/central-interior.png);
}
body {
        background-image: url(/img/bg.gif);
}
-->
</style>
</head>

<body>
<div class="center">
  <table width="100%"  border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF">
    <tr>
      <td width="33%"><img src="/img/logosep.gif" alt="Secretaría de
Educación Pública" width="145" height="64" /></td>
      <td width="33%"><div align="center"><img src="/img/logoseit.gif"
alt="Dirección General de Institutos Tecnológicos" width="121"
height="64" /></div></td>
      <td width="33%"><div align="right"><img src="/img/logoitlp.gif"
alt="Instituto Tecnológico de La Paz" width="95" height="69"
/></div></td>
    </tr>
  </table>
  <table width="100%"  border="0" cellpadding="0" cellspacing="3"
bgcolor="#FFFFFF">
    <tr>
      <td height="20"><div align="right">Bienvenido, {usuario}.</div></td>
    </tr>
  </table>
  <table width="779" height="21"  border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="185" height="21" background="/img/barrafecha.png">{fecha}</td>
      <td background="/img/barramenu.png">{menuSuperior}</td>
    </tr>
  </table>
  <table width="100%" height="36"  border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="36" background="/img/barratitulo.png"><div
align="right"><img src="/util/dynheader.php?text={tituloSeccion}" 
/></div></td>
    </tr>
  </table>
  <table width="779"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="27" height="147" valign="top"><img
src="/img/marcoizq-interior.png" alt="Izquierda" width="27"
height="147" /></td>
      <td class="bg"><p>{contenido}</p>
      </td>
      <td width="33" height="147" valign="top"><img
src="/img/marcoder-interior.png" alt="Derecha" width="33" height="147"
/></td>
    </tr>
  </table>
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td bgcolor="#FF0000">{menuInferior}</td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="center"><img
src="/img/bottom.gif" width="758" height="47" border="0" usemap="#Map"
/></div></td>
    </tr>
  </table>
</div> 
<map name="Map" id="Map">
  <area shape="rect" coords="363,23,539,34" href="/w/content/contacto" />
  <area shape="rect" coords="300,33,449,48" href="/w/content/creditos" />
</map>
</body>
</html>

</the html file>

> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Francisco Javier Escoppinichi Fernández
Email: [EMAIL PROTECTED] 
Web: http://www.fire-dragon.net/
MSN: [EMAIL PROTECTED]
Cel: 044 (612) 348 91 00

"Sólo hay 3 cosas que no vuelven atrás: la palabra emitida, la flecha
lanzada y la oportunidad perdida."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to