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? Quote 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> Quote 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? Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/135637-current-html-page-title/#findComment-707041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.