Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/06/2012, 11:41
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: rellenar <h1>, <h2> y <h3> con el contenido de <title>

Creo que php sigue siendo la mejor opción

escribir.php
Código PHP:
Ver original
  1. <?php
  2. header("Content-Type: text/html;charset=utf-8");
  3. $archivo_titulos = 'titulos.txt';
  4. $fp = fopen( $archivo_titulos, 'r' );
  5. $contenido_archivo = fread( $fp, filesize( $archivo_titulos ) );
  6. fclose( $fp );
  7. // linea a linea.
  8. $lineas = explode ( "\n", $contenido_archivo );
  9. $n = 1;
  10. foreach ( $lineas as $titulo ) {
  11. $contenido ="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
  12. \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  13. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  14. <head>
  15. <title>$titulo</title>
  16. <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />
  17. </head>
  18. <body>
  19. <h1>$titulo</h1>
  20. <h2>$titulo</h2>
  21. <h3>$titulo</h3>
  22. </body>
  23. </html>
  24. ";
  25. file_put_contents("archivo_". $n . ".html",$contenido);
  26. $n++;
  27. }
  28. ?>

y un archivo titulos.txt que contiene un titulo por línea

Código txt:
Ver original
  1. título1
  2. título2
  3. título3
  4. título4
  5. título5
  6. título6
  7. otro título
  8. contactos
  9. tarifas
  10. usuarios

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.