|  | Posted by Toby A Inkster on 07/30/07 13:13 
Paul Furman wrote:
 > I know it's wrong but it works: putting the <title> in the body of the
 > document inside another <head> because I'm generating this with php &
 > kind of boxed myself into not having access to the text I want till I
 > get well into the body
 
 <?php
 
 // I don't know the title yet, so I'll turn on output buffering and
 // then output an empty title.
 ob_start();
 print "<html>\n";
 print "<head>\n";
 print "<title></title>\n";
 print "</head>\n";
 
 // OK. Now I know what the title is, so switch off output buffering
 // and replace the empty title with the known title.
 $title = 'Lalala';
 print str_replace('<title></title>',
 "<title>$title</title>",
 ob_get_clean());
 
 ?>
 
 --
 Toby A Inkster BSc (Hons) ARCS
 [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
 [OS: Linux 2.6.12-12mdksmp, up 39 days, 16:46.]
 
 demiblog 0.2.2 Released
 http://tobyinkster.co.uk/blog/2007/07/29/demiblog-0.2.2/
  Navigation: [Reply to this message] |