Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
How would I be able to set the pages title as content from a text file?

I have a page that needs a dynamically updated title. I have a .txt file that is dynamically updated by another script on my website, and I would like to set the content of that file as the page title (the <title> tag). Can somebody help me?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

follow the below example, I am not tested it but try it once

<?php
   $data = fopen("c:\\folder\\testing.txt", "r");
   $ln_array = [];
   $fp = fopen("testfile.txt", "r");
   while (!feof($fp)) {
       // do stuff to the current line here
       array_push($ln_array, $fp);
   }
   fclose($fp);

?>
about 4 years ago · Juan Pablo Isaza Denunciar

0

In PHP, you can read the txt file and make à echo later

<!DOCTYPE html>
<html lang="en">
<head>
    <?php
      $myfile = fopen("file.txt", "r") or die("Unable to open file!");
      $content = fgets($myfile);
      fclose($myfile);
    ?>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo htmlspecialchars($content, ENT_QUOTES, 'UTF-8'); ?></title>
</head>
<body>
    
</body>
</html>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda