|
|
|
|
![]() ![]() |
Apr 18 2005, 12:53 AM
Post
#1
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
I'll set up the background for the question: I have a separate file that I include on all the webpages on my site which I call with PHP using the include() function, so everything will be much easier to maintain and update. Well, I have three include files for each page: header.php (includes stuff like meta tags, googlebot/spider info), footer.php (the footer/copyright thing), leftnav.php (includes the navigation bar). I also like the titles of my pages to be as descriptive as possible so I try to include the path of a page (how the user got to that page: "Excite Yourself : Games : Reaction") between my <title> tags.
Problem: The thing is that I've recently decided to change my site title to something less generic and more creative. I was thinking about moving the title tag in all my pages to the header file first. Is there a way so I can change all the "Excite Yourself"'s without having to update every single page on my site? Like, include the <title> tags in my header.php file? What I was thinking: I was thinking about putting this code in my site: CODE <html> <?php include("header(title of page).php"); ?> However, I don't think the code above is legal in PHP syntax. Then, in header.php, I can have a statement that takes in title of page and append that to "New Title Name : Games : Reaction" As you can tell, I'm not really good with PHP, but I did my best to try to explain to you my situation. Any help/suggestion is appreciated |
|
|
|
Apr 18 2005, 01:15 AM
Post
#2
|
|
|
Administrator ![]() Group: Admin Posts: 1,448 Joined: 11-June 04 From: Somewhere in Time & Space. Member No.: 1 |
How about declare a variable $title before including the header file
CODE $title="This is the title of my new page"; include("location-of-header-file.inc.php"); Inside the header file, You can use this variable $title. HTML <!-- Contents of Header file --> <html> <head> <title><?=$title?></title> </head> Try this out, I haven't tested it. But it should work. |
|
|
|
Apr 18 2005, 01:36 AM
Post
#3
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
Such a simple solution to what seemed to be a complex question. Thanks, OpaQue! I'm voting for you in my own poll
Problem solved -> thread closed |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 24th July 2008 - 02:18 PM |