getting a variable from a file



I am using a script to generate a sitemap. It displays the page names
(mypage.php) but I want it to display the titles. The page heads and <title>
are generated dynamically so the line below does not work

if(preg_match("'<title>(.+)</title>'i", $f, $matches)){

However all the paged titles are stored in a variable $pageTitle. On every
page like this

$pageTitle="Who We Are";

how can I retrieve this variable? I tried

echo $pageTitle and $_GET['pageTitle']



function getTitle($file){

global $htmltypes;

$title="";

$p=pathinfo($file);

if(!in_array(strtolower($p['extension']),$htmltypes)){

$f=file_get_contents($file);

if(preg_match("'<title>(.+)</title>'i", $f, $matches)){

$title=$matches[1];

}

}

$title=$title?$title:basename($file);

return htmlentities(trim(strip_tags($title)));

}

?>
.



Relevant Pages

  • Re: [PHP] getting a variable from a file
    ... The page heads and ... However all the paged titles are stored in a variable $pageTitle. ... In your sitemap script, are you scraping your own site? ...
    (php.general)
  • RE: Showing song titles on CDs with Windows Media Player
    ... Windows Media Player does not ... recognize my CD title, and instead of displaying my song titles, it displays ... I can use various Windows- based players which display the title of my CD ... Player is incapable of at least displaying my song titles on a homemade ...
    (microsoft.public.windowsmedia.player)
  • Showing song titles on CDs with Windows Media Player
    ... Windows Media Player does not ... recognize my CD title, and instead of displaying my song titles, it displays ... I can use various Windows- based players which display the title of my CD ... Player is incapable of at least displaying my song titles on a homemade ...
    (microsoft.public.windowsmedia.player)
  • Re: Question for RosAsm users
    ... GUI programming editors don't implement it yet. ... But is there a way to display the source for all the TITLEs of a ... small, then it's TITLEs can be displayed simultaneously, thus saving ... the user to use the TITLE bar for small sources where normal scrolling ...
    (alt.lang.asm)
  • Re: Stationery
    ... Incoming mail displays stationery and plays sound as normal." ... > Have lost the ability to choose or display stationery in OE. ... > I can't select any for outgoing mail because while the titles show up in ... > browser, they do not display in the new mail that opens. ...
    (microsoft.public.windowsxp.perform_maintain)