Is there a PHP variable that holds the page title?
I would like to get a hold of the title of the page that I at,(The text at the top of the browser) for later storage.
Thanks!

I don't if there is one but you can use this technique :-

<html>
<head>
<?php
include("somefile.php");
?>
<title><?php echo $page_title; ?></title>
</head>
</html>

The $page_title variable gets it's value from the included files.

commented: useful +5
Member Avatar for diafol

What do you mean 'for later storage'?

What do you mean 'for later storage'?

What he means is that is there a variable or function or anything else that can catch the page title and later store in a variable.

Member Avatar for diafol

OK...

similar to a previous post:

<?php
$title = "blah blah blah";
?>
...
<head>
...
<title><?php echo $title;?></title>
...
</head>
<body>
<p>The title is <?php echo $title;?></p>
</body>
...

PHP is on server side and HTML page is on client. So practically impossible unless you do echo the variable either hold in session or file to include. Then keep modify that between pages!

OK! Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.