caroa Posted November 7, 2009 Share Posted November 7, 2009 I have several web pages that all use the same includes file, and I wanted to give them unique titles. Therefore I used function title() { echo "Page Title"; } on each page to set the page's title (and title(); in the includes file between <title> and </title>). How would I go about using the includes file for one of my pages, but not breaking the code if I want to include another function that the other pages don't have? Link to comment https://forums.phpfreaks.com/topic/180692-solved-functions-and-page-titles/ Share on other sites More sharing options...
cags Posted November 7, 2009 Share Posted November 7, 2009 Hard to tell exactly what your after from your description so I'll make a guess. When including a global header that you wish to have on multiple pages, but you wish for different head information. home.php $title = "My title"; include 'header.php'; header.php <head> <title><?php echo $title; ?></title> </head> Link to comment https://forums.phpfreaks.com/topic/180692-solved-functions-and-page-titles/#findComment-953335 Share on other sites More sharing options...
caroa Posted November 7, 2009 Author Share Posted November 7, 2009 Hard to tell exactly what your after from your description so I'll make a guess. When including a global header that you wish to have on multiple pages, but you wish for different head information. home.php $title = "My title"; include 'header.php'; header.php <head> <title><?php echo $title; ?></title> </head> Thank you so much! That didn't answer my question completely, but I somehow figured it out after going off what you wrote. I'm tired because I've been trying to figure out how to do this for a while, so sorry if I'm a bit incoherent. Anyway, you helped me out a lot. Muchas gracias. Link to comment https://forums.phpfreaks.com/topic/180692-solved-functions-and-page-titles/#findComment-953344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.