Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

324
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!