how do you change one thing on all your pages

i wana change things on my sidebar (nav)

Page 1 of 1

8 Replies - 2458 Views - Last Post: 04 March 2006 - 02:24 PM

#1 _heiikee  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-December 05

how do you change one thing on all your pages

Posted 08 December 2005 - 10:07 PM

hmm .. kay ive been making a website for the past month. but i what i wanted to know is if there was a way to change one thing on my nav bar and then change it on all my other pages w/o doing each page individually. ahha please help if you can thanks :D
Is This A Good Question/Topic? 0
  • +

Replies To: how do you change one thing on all your pages

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: how do you change one thing on all your pages

Posted 08 December 2005 - 10:35 PM

If your webhost doesn't support a server side scripting langauge you could do something with Javascript.

You could either have all the HTML in a js file and output that HTML with document.write().
document.write("This<br>is<br>HTML.");


Or you could use XMLHttpRequest to make something similar to PHP's include() function.
//Note the following code is writen for Firefox and is not tested.
/*returns FALSE if obj.readyState doesn't equal 4.
function getMenu() {
	rtn = FALSE;
	if(obj.readyState == 4) {
  rtn = obj.responseText;
	}
	
	return rtn;
}

obj = new XMLHttpRequest();
obj.open("get", "http://example.com/menu_file.html");
obj.send(null);

obj.onreadystatechange = getMenu();

This post has been edited by hotsnoj: 08 December 2005 - 10:38 PM

Was This Post Helpful? 0
  • +
  • -

#3 Mrafcho001  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 41
  • View blog
  • Posts: 769
  • Joined: 01-November 05

Re: how do you change one thing on all your pages

Posted 09 December 2005 - 10:52 AM

In school we were learning about Shared borders (in frontpage), its the same on all pages, maybe use a shared border for your navigation bar?

On my website i dont really change much around, and never really used it.
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how do you change one thing on all your pages

Posted 09 December 2005 - 11:06 AM

Shared borders is a FrontPage concept, and unfortunately does not conform to web coding standards. The user would be better off designing the navigation bar as a separate file, and include the file on each page. That way, a change made in the original file is reflected in all pages.
Was This Post Helpful? 0
  • +
  • -

#5 WMIIII923  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 10-February 06

Re: how do you change one thing on all your pages

Posted 19 February 2006 - 06:12 AM

can you explain the document.write in more detail?
Was This Post Helpful? 0
  • +
  • -

#6 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how do you change one thing on all your pages

Posted 19 February 2006 - 07:30 AM

document.write is a javascript method that inserts the text supplied as a parameter directly into the html page.
Was This Post Helpful? 0
  • +
  • -

#7 WMIIII923  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 10-February 06

Re: how do you change one thing on all your pages

Posted 19 February 2006 - 07:38 AM

can you use links in JS? If so, how?
Was This Post Helpful? 0
  • +
  • -

#8 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: how do you change one thing on all your pages

Posted 19 February 2006 - 08:28 AM

Well, I'll refer you to the other thread you opened on this same topic...but there are many ways to do it. Assign the link to a variable (hotsnoj has shown you how in the other thread), and write it to the form/page wherever you want it.
Was This Post Helpful? 0
  • +
  • -

#9 Aaroniza  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 04-March 06

Re: how do you change one thing on all your pages

Posted 04 March 2006 - 02:24 PM

I don't know of any method of doing it automatically without prior work. But the best thing I've found to do is use PHP and "include" your pages. Its a very good way to insert content from a file directly onto your page , and only in a few lines of code!. Example:
<?PHP
include("navbar.inc");
?>


That would include all the text and code from navbar.inc onto the current page , so , if you put all your links and things from your navigation box into navbar.inc and include the file (like i did above) into the area where the links should be , you can just edit the inc file and it's updated site wide. But also be sure the page(s) that you have the PHP code in end with .php instead of .html or .htm , and also make sure that you CHMOD the inc files to keep them away from prying eyes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1