PDA

View Full Version : Title Bar HTML in 1 file, displayed on every webpage?



david14259
Jun 27th, 2005, 04:10 PM
Greetings,

I am in the process of creating a website. I have a title/navigation bar made that I want displayed at the top of every page. Is it possible to keep the HTML for the title bar in 1 file, and use Javascript (or, if not JS, what?) to display the title bar on every webpage in my site.

Thanks for the help!
David

jbot
Jun 27th, 2005, 04:15 PM
lookup Serverside Includes (SSI)! :thumbsup:

Bill Posters
Jun 27th, 2005, 04:17 PM
Take a look at PHP's include() (http://uk2.php.net/function.include) function.
You should run a search for the term include in the forum's PHP section.

You might also find the following thread usefulů
http://www.codingforums.com/showthread.php?t=60549

david14259
Jun 27th, 2005, 04:44 PM
If anyone is interested in following this topic, I'm moving over to the PHP forum in this thread:

http://www.codingforums.com/showthread.php?p=326278#post326278

Thanks for the help!

martin_narg
Jun 27th, 2005, 04:45 PM
It is possible to do this in javascript, however as already previously mentioned it is much more efficient and better practice to use SSI/PHP/ASP includes.

To reference the title property of the page in JavaScript you can use this:



document.getElementsByTagName("title")[0].innerHTML;


Hope this helps

m_n

david14259
Jun 27th, 2005, 04:49 PM
It is possible to do this in javascript, however as already previously mentioned it is much more efficient and better practice to use SSI/PHP/ASP includes.

To reference the title property of the page in JavaScript you can use this:



document.getElementsByTagName("title")[0].innerHTML;


Hope this helps

m_n

I'm really not very good with JS yet. Could you explain the above line of code a bit more: does it go in the head or body of an HTML page? do I change the "document" or the "innerHTML" or "...." to point to the file I want to display on each webpage? Thanks!

jbot
Jun 27th, 2005, 04:51 PM
JS != SEO

if you want your site to work better re google, yahoo, etc, then give the JS a miss. :thumbsup:

david14259
Jun 27th, 2005, 04:53 PM
JS != SEO

if you want your site to work better re google, yahoo, etc, then give the JS a miss. :thumbsup:


Ok, forget the JS then...if Anyone of you are familiar with PHP, could you visit the thread (linked above) and see if you can help me out there. Thanks for everyone's help!

EDIT: Here's the thread - http://www.codingforums.com/showthread.php?t=62214

EDIT #2: A Search for SSI brought me to "Scuba Schools International - Serious Diving, Serious Fun." I found that funny. Stop looking at me like I'm crazy.

david14259
Jun 27th, 2005, 07:37 PM
Thanks again for everyone's help! I just figure out how to do it with SSI...just had to reconfigure our webserver.

Have a good day!