PHP - funcion flush

 
Vista:

funcion flush

Publicado por octavio (2 intervenciones) el 13/07/2005 19:47:44
Hola, tengo una pagina de espera en ASP:

<%
Response.Buffer = True
%>
<BODY BGCOLOR="#FFFFFF">
<DIV ID="splashScreen" name="otro" STYLE="float:center;z-index:5;top:30%;left:35%;">
<TABLE BGCOLOR="#000000" BORDER=1 BORDERCOLOR="#000000" CELLPADDING=0 CELLSPACING=0 HEIGHT=200 WIDTH=300>
<TR>
<TD WIDTH="100%" HEIGHT="100%" BGCOLOR="#CCCCCC" ALIGN="CENTER" VALIGN="MIDDLE">
<BR><BR>    
<FONT FACE="Helvetica,Verdana,Arial" SIZE=3 COLOR="#000066"><B>Page Loading. Please wait...</B></FONT>
    <BR>
<IMG SRC="barraProgreso.gif" BORDER=1 ><BR><BR>
</TD>
</TR>
</TABLE>
</DIV>
<%Response.Flush%>

Procesos que se deben hacer.

<%Response.Flush%>
<SCRIPT LANGUAGE="JavaScript">
var splash = document.getElementById("splashScreen");
splash.style.display = "none";
</SCRIPT>
</BODY>
</HTML>

Con el response.Flush, me da la pauta para mandar al explorador del cliente, pedazos de codigo HTML, generado, para simular que ese esta trabajando y procesando la información, y all fin muestra la información y desaparece el mensaje.

El problema es que trate de ocupar esta misma logica con PHP, y la función flush, pero no me lo hace , me muestra como esta procesando los datos y no da la pauta.

<?ob_start();?>
<BODY BGCOLOR="#FFFFFF">
<DIV ID="splashScreen" STYLE="position:absolute;z-index:5;top:30%;left:35%;">
<TABLE BGCOLOR="#000000" BORDER=1 BORDERCOLOR="#000000" CELLPADDING=0 CELLSPACING=0 HEIGHT=200 WIDTH=300>
<TR>
<TD WIDTH="100%" HEIGHT="100%" BGCOLOR="#CCCCCC" ALIGN="CENTER" VALIGN="MIDDLE">
<BR><BR>    
<FONT FACE="Helvetica,Verdana,Arial" SIZE=3 COLOR="#000066"><B>Page Loading. Please wait...</B></FONT>
    <BR>
<IMG SRC="barraProgreso.gif" BORDER=1 ><BR><BR>
</TD>
</TR>
</TABLE>
</DIV>
<?
ob_flush();
ob_end_clean();
ob_start();
$db = 'C:\\Inetpub\\wwwroot\\php\\bd1.mdb';

$conn = new COM('ADODB.Connection');

// Two ways to connect. Choose one.
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
//$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

$sql = 'SELECT * FROM etiquetas ORDER BY etiqueta';
$rs = $conn->Execute($sql);

for ($i=1; $i <= 5; $i++)
{
$rs->MoveFirst()
?>

<table>
<tr>
<th>pagina</th>
<th>idioma</th>
<th>etiqueta</th>
</tr>
<? while (!$rs->EOF): ?>
<tr>
<td><?= $rs->Fields['pagina']->Value ?></td>
<td><?= $rs->Fields['idioma']->Value ?></td>
<td><?= $rs->Fields['etiqueta']->Value ?></td>
</tr>
<? $rs->MoveNext() ?>
<? endwhile ?>
</table>

<?
}
ob_end_flush();
$rs->Close();
$conn->Close();

?>
<SCRIPT LANGUAGE="JavaScript">
var splash = document.getElementById("splashScreen");
splash.style.display = "none";
</SCRIPT>
</BODY>
</HTML>

Alguien podria ayudarme, que conozca más PHP.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:funcion flush

Publicado por Mike79 (669 intervenciones) el 14/07/2005 05:36:34
En lugar de usar las funciones de ob_flush y demas, mejor utiliza flush y te evitas de problemas.

http://www.php.net/manual/es/function.flush.php

La forma de usarse es muy sencilla:

html que quieres mandar
flush();
cosas que tienes que hacer y cuadno termine, cosas que manda......

Saludos!
-
Miguel Angel
Mike79
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar