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)));

}

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to