busillis Posted March 26, 2009 Share Posted March 26, 2009 I have a include file called header, that takes the logo and navigation so that i dont need to duplicate code. Problem is, <title> comes with this and I want this to be different for each page. I.e. "page a - website name", "page b - website name" Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/ Share on other sites More sharing options...
waynew Posted March 26, 2009 Share Posted March 26, 2009 Change the header file so that it doesn't include the <head></head> tags. Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794516 Share on other sites More sharing options...
wmguk Posted March 26, 2009 Share Posted March 26, 2009 set $title = $_GET['title']; <title><?php echo $title; ?></title> and then in the url show www.mywebsite.co.uk/index.php?title=this is a great website very basic, and wrong in so many ways but would happily do the job Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794518 Share on other sites More sharing options...
scottybwoy Posted March 26, 2009 Share Posted March 26, 2009 Another way would be to set the title in the calling script. i.e. $title = "this is a great website", before the include. Then replace the <title> tags in the header like wmguk has shown : <title><?php echo $title; ?></title> Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794521 Share on other sites More sharing options...
busillis Posted March 26, 2009 Author Share Posted March 26, 2009 Thanks guys. One additional problem I have realised as well: The navigation is in the header and it differs based on what page you are on; i.e. one of the buttons has a property called "selected". Perhaps if I made all the code in header a function and passed a page name as a param? Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794528 Share on other sites More sharing options...
scottybwoy Posted March 26, 2009 Share Posted March 26, 2009 Could work Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794531 Share on other sites More sharing options...
busillis Posted March 26, 2009 Author Share Posted March 26, 2009 It works! Perhaps a little strange but!! Quote Link to comment https://forums.phpfreaks.com/topic/151251-solved-making-different-for-each-page-when-it-is-being-included/#findComment-794536 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.