Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/04/2009, 19:49
Lemuriano
 
Fecha de Ingreso: abril-2009
Mensajes: 35
Antigüedad: 15 años
Puntos: 1
Respuesta: Hacer que si un archivo existe ponga el link a este y sino no

mmmmm..... la verdad que no entiendo nada.... Lo que decis me parece muy coherente, sin embargo en el primer ejemplo que di no lo escribi como vos decis (fijate en el primer codigo que pegue) y sin embargo funciona perfecto. El unico problema que me llevo a querer modificarlo, es que previa comprobacion de si el archivo existe o no, ponga o no el link segun corresponda, y es ahi donde no pude hacerlo funcionar mas.
Ahora modifique de todos modos textos con comillas y variables sin comillas y separadas por puntos entre texto y variables...sin embargo sigue sin funcionar, y este es el error que tengo ahora:

Parse error: syntax error, unexpected T_STRING in ... hace referencia a esta linea: print <a href=$filename."/zips/".$filename$.endfile><img src="images/zip.jpg" width="73" height="60"></div></td> ;

Código PHP:
<? 
    $number 
str_pad($gal3"0"STR_PAD_LEFT) ;
    
$endfile ".rar" ;
    
$endfile2 "_hi_res.rar" ;
    
$filename "PHOTOS/".$number."/zips/".$number.$endfile ;
    
$filename2 "PHOTOS/".$number."/zips/".$number.$endfile2 ?>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center"><img src="images/line.png" width="500" height="25" /></div></td>
  </tr>
</table>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CFEBEF">
  <tr>
    <td width="80" rowspan="2"><div align="center">
    <? 
    
if (file_exists($filename)) {
        print <
a href=$filename."/zips/".$filename$.endfile><img src="images/zip.jpg" width="73" height="60"></div></td> ;
        }
    else { print <
img src="images/zip.jpg" width="73" height="60"></div></td> ; 
    } 
?>
    <td width="200" height="30" valign="bottom"><div align="left" class="Estilo3">Download Full Photoset</div></td>
    <td width="200" height="30" valign="bottom"><div align="right" class="Estilo3">Download Full Photoset</div></td>
    <td width="80" rowspan="2"><div align="center">
    <? 
    
if (file_exists($filename)) {
        print <
a href=$filename2."/zips/".$filename2.$endfile2><img src="images/zip.jpg" width="73" height="60"></div></td> ;
        }
    else {print <
img src="images/zip.jpg" width="73" height="60"></div></td> ; 
    } 
?>
  </tr>
  <tr>
    <td width="200" height="30" valign="top"><div align="left" class="Estilo3">Lo-Res (1024x768)</div></td>
    <td width="200" height="30" valign="top"><div align="right" class="Estilo3">Hi-Res (2560x1920)</div></td>
  </tr>
  <tr>
    <td width="80"><div align="center"><? print  round(filesize($filename) / 1000000) . " Mb" ?>
    </div></td>
    <td height="30" valign="top">&nbsp;</td>
    <td height="30" valign="top">&nbsp;</td>
    <td width="80"><div align="center"><? print  round(filesize($filename2) / 1000000) . " Mb" ?>
    </div></td>
  </tr>
</table>