|
Posted by BigDaddyBS on 02/06/07 19:21
"Talal Itani" <titani@verizon.net> wrote in message
news:5CGxh.2512$6P4.2044@trnddc06...
>
> I am designing a web site and would like to know how to make my navigation
> buttons appear on every page of the site. Currently, I select the buttons
> and I paste them on every single page, but this is getting annoying, since
> I always have do changes to the buttons. I am using Web Page Maker V2.
> Thank you very much.
>
> Regards,
> T.I.
-----
I too went through the "cut-and-paste" phase, and quickly went into a
"JavaScript" phase before actually figuring out how to do SSI. There are
plenty of JS examples on the web, but I'll see if I can quickly describe the
way I did it. (I know it might not be the best, but it worked for me for
years, and I still currently have sites out there using it.)
1) create a text file containing the HTML of your buttons.
(Whether your HTML uses a table, simple text buttons, or list, it doesn't
matter.)
2) At the top of the file, put a line "<!-- Begin" (no outer quotes... The
comment tag ("<!--" hides the file from non-scripting browsers, and "Begin"
is just for you, I believe)
3) At the beginning of each line, put "document.write('" (no outer quotes)
4) At the end of each line, put "');" (again, no outer quotes)
5) At the end of the file, put "// End -->" (no outer ... get the idea? I
think all that's really needed is the close comment "-->")
6) Save the file with the extension ".js" (I suggest putting it in your root
directory (www.xxx.com))
NOTE: If there are any apostrophes within the button HTML, there's another
step (creating variables and adding them into the lines) which isn't that
difficult, but, hopefully, you have cleaner button HTML than I did. ;-)
And you should also "escape" any close-tag slashes (e.g.: instead of "</p>"
use "<\/p">) as it seems some browsers will take the first non-escaped "/"
they run across as an end-tag for the JavaScript.
Now, in each HTML file, where you wish for the navigation to go, put the
following:
<SCRIPT LANGUAGE="JavaScript" src="navigationfilename.js"
type="text/javascript"></script>
This line, also, should probably be "hidden" from non-scripting browsers, by
commenting it out "<!--" line "-->", though I have pages that work and it's
not.
Any CSS formatting in this file will translate, as in this case,
document.write is done when loading the page. (The HTML between the
apostrophes is written to your main-page HTML)
Now, when you need to add buttons, all you have to edit is the .js file,
cut-and-paste a copy of one of them where you wish the new one to go, and
make your changes to the pasted text.
Be aware that in non-scripting browsers or those with it turned off, the
navigation will not be available. This is one of the reasons you see those
text links in a "linkbar" or simply added at the bottom of pages. (With at
least one link to ... say ... the Sitemap page, where links to every page
are organized...)
All I know is this method worked/works for me.
Ok... I think I'm ready ... All you "experts" - Tell me if (I'm sure some of
you guys simply assume "what") I did or described wrong, or provide further
descriptions.
BigDaddyBS
[Back to original message]
|