Please help....

i dont have the time to update my left menu on every page on my site... how do I make a script that links to a site where I make an update and the updates are then seen on all pages ? Thanks<!--content-->Pleae help is not very descriptive. if you want somebody to help you need to have a title that explains a littel what you are trying to do.<br />
<br />
for what you want is called SSI (server side includes) you will have to rename your file to have a .shtml extension. this will also depend on the server having it enabled so you can run it. other than that you need to use javascript and put your links and stuff in a file and link it in everypage. the file should have a.js extension.<!--content-->You can use server side includes as explained by scoutt (this is the cleanest/best way to do it).<br />
<br />
If your webhost do not support server side include (SSI) then you can do it in javascript, but it is not as 'clean' but still managable.<br />
<br />
In the left hand column where you want the data to appear you write following:<br />
<br />
<script language="javascript" src=http://www.htmlforums.com/archive/index.php/"nav.js"></script><br />
<br />
The above script will import a so-called javascript library (.js). I have called it nav (for navigation, smart eh ? :P )<br />
<br />
All you have to do is to break up your "links" html code into javascript. Here is an example:<br />
<br />
file: nav.js:<br />
<br />
<!--<br />
var myLinks = new Array();<br />
<br />
// Here goes the links:<br />
myLinks[0] = ["http://www.disney.com/","disney"];<br />
myLinks[1] = ["www.yoursite.com/page3.html","your-3"];<br />
myLinks[2] = ["/subdir/page5.html","flower power"];<br />
// add as many as you like<br />
<br />
var out = "";<br />
out += "<table cellspacing=0 cellpadding=0 border=2>";<br />
out += "<tr><td>";<br />
out += "<b>Navigate:</b>";<br />
out += "</td></tr>";<br />
out += "<tr><td>";<br />
out += "<a href='http://www.htmlforums.com/index.html'>Home</a>";<br />
out += "</tr></td>";<br />
<br />
for (var i=0;i<myLinks.length;i++){<br />
out += "<tr><td>";<br />
out += "<a href='http://www.htmlforums.com/archive/index.php/"+myLinks[0]+"'>"+myLinks[1]+"</a>";<br />
out += "</td></tr>";<br />
}<br />
out += "</table>"; <br />
<br />
document.write(out);<br />
//--><br />
<br />
<br />
As you can see the regular HTML is broken up and is being printed out with ONE document.write statement. The for-loop will go through the arrays (myLinks) and print out all the links.<br />
<br />
All you have to do is to make changes in the nav.js file and provided you put the first mentioned script into the left column of all your pages then your navigation table will always be the same and update immediately.<br />
<br />
Just create above code in an empty word processing document and save it as 'text' format and with the extention .js (instead of saving as nav.html or as nav.txt then save as nav.js).<br />
<br />
Please feel free to post again if you need clarification.<!--content--><script language="javascript" src=http://www.htmlforums.com/archive/index.php/"nav.js"></script><br />
will work, but don't forget to change it if you would like it to validate as well:<br />
<script language="javascript" src=http://www.htmlforums.com/archive/index.php/"nav.js" type="text/javascript"></script><!--content-->thanks scoutt for the explanation, but in order to use .shtml, do I have to learn anything, such as any server side languages?<br />
<br />
and thank you kdjoergensen, for the code.<br />
I am able to write the nav code in javascript myself, but I stil have a question: I know .js stands for JavaScript file, but does it have the exactly same syntax as Javascript (because I saw some .js files that there are different in syntax from Javascript)<br />
<br />
and thank giz for the reminder!<!--content-->you shouldn't. all you need to know is the includes or the "virtual includes" I myself even forget them and have to look them up.<!--content-->I'm new to that way of doing it. But I do do it a different way. I use PHP. So Say on a page called myvacation I can have a nav bar (Links) say include links.php. I have done it on my Site Drawing Society Of Canada (<!-- m --><a class="postlink" href="http://www.drawingsociety.com">http://www.drawingsociety.com</a><!-- m -->) . So on that page I have three Webpages in One. I make a layout and then in that layout I tell it to call Nav.php, news.php, header.php. And when It loads it looks like one. So when I add a link to the nav.php file it changes my whole entire website.<br />
<br />
I have a question. what was is better? SSI or PHP?<br />
<br />
Thanks in Advance.<br />
DD<!--content-->well SSI is nothing like php so it really is up to you. if you go with SSI you can't run php, but if you go php then you have the best of both worlds; includes and dynamic content with a DB.<!--content-->Originally posted by scoutt <br />
well SSI is nothing like php so it really is up to you. if you go with SSI you can't run php, but if you go php then you have the best of both worlds; includes and dynamic content with a DB. <br />
<br />
Ohh awesome. Then I started with the right one then (PHP)<br />
Thanks for the quick reply.<br />
<br />
DD<!--content-->You could use a navigation frame. To get rid of the border use the FRAMEBODER="0" option to reomve the border.<br />
<br />
Phil<!--content-->An external javascript file has exactly same syntax as in page javascript.<br />
<br />
SSI require server side access which some webhosts do not offer.<!--content-->ok thanks for awesome replies people!<br />
<br />
hmm... I am still confused! let's say that if I want to use SSI and my host DOES support it, is it all I have to do is to change .html to .shtml? Or I have to include some code in my web pages?<!--content-->all you have to do is includes, read about them here<br />
<br />
<!-- m --><a class="postlink" href="http://hotwired.lycos.com/webmonkey/html/97/07/index2a.html">http://hotwired.lycos.com/webmonkey/htm ... dex2a.html</a><!-- m --><!--content-->
 
Back
Top