millsy007 Posted December 5, 2008 Share Posted December 5, 2008 I would like to be able to create a $pagetitle variable in php for my pages that will contain the current HTML page title for that page. I have had a look around but there doesnt seem to be any class/code out there to do this? Link to comment https://forums.phpfreaks.com/topic/135637-current-html-page-title/ Share on other sites More sharing options...
spewperb Posted December 5, 2008 Share Posted December 5, 2008 <?php $pageTitle = "My Page Title"; ?> <html> <head> <title><?php echo $pageTitle; ?></title> </head> <body> </body> </html> Link to comment https://forums.phpfreaks.com/topic/135637-current-html-page-title/#findComment-706637 Share on other sites More sharing options...
millsy007 Posted December 5, 2008 Author Share Posted December 5, 2008 Thanks. But my Problem is that the HTML pages have already been created for 100s of pages using adobe contribute (where they will also be edited) I would like therfore to be able to access the current HTML titles and assign them as a variable? Link to comment https://forums.phpfreaks.com/topic/135637-current-html-page-title/#findComment-707034 Share on other sites More sharing options...
premiso Posted December 5, 2008 Share Posted December 5, 2008 You can always use file_get_contents then use a preg_replace that finds the title tags and replaces them with what you want then echo the html file to the screen. Other than that you have to manually edit each file. Fun stuff. Link to comment https://forums.phpfreaks.com/topic/135637-current-html-page-title/#findComment-707041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.