Results 1 to 8 of 8
Related
-
How do you use the “include function” to put a HTML Page (top.htm) onto a PHP Page? Forum: PHP Forum
Replies: 1 -
html page break Forum: HTML Forum
Replies: 3 -
Passing variables from HTML page to page Forum: HTML Forum
Replies: 1 -
Javascript document.write problems Forum: Javascript Forum
Replies: 3 -
How to write a HTML page that presents its contents according to the client language? Forum: HTML Forum
Replies: 1
-
10-24-2003, 02:46 PM #1
multi-level JavaScript document.write / html page within a html page
I'm working on the redesign of a corporate intranet site for a government agency, so links won't be possible. The corporate server supports Java and JavaBeans only. That means, no ASP; no PHP; no includes.. just JavaScript. The political redtape dictates that they will not allow support for these within the next year or two. There isn't really a founded reason for it, but that's the way it is. I don't know JavaBeans or have the time luxury to learn it.
The issue I am having is with a Quick Links type of navigation that is displayed on each page in a boxed area. The navigation has pop-out sub-menus. The contents will change frequently. To avoid hand-coding each page (about a thousand), I'm calling an external JavaScript(JS) to the page. The contents of the JS file uses document.write to generate the necessary HTML coding, etc for the Quick Links navigation. The JS file is within a directory with all the other JS files.
I've encountered problems because the back-end structure of the site consists of multiple hierarchies/levels, but just three of them. (Ridiculous example to clarify: icing level, donut level and jelly level) When the JS is written onto the page, the relative paths assigned for the navigation links are either one or two levels too low, and generate 404s or broken images.
Is there a method (no frames, iFrames or iLayers please) to circumvent this problem without creating a tweaked JS file for each directory level?
Or, even better, is there a method to dynamically change the contents of a div on a page with the contents of a static HTML page without using frames - similar to innerHTML and a variable, but displaying an entire HTML file like a frame would?
-
10-25-2003, 11:20 AM #2
-
10-25-2003, 03:59 PM #3
You best bet would be to use absolute paths in all the dynamically generated content. Then the links would work wherever.
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
11-04-2003, 01:35 PM #4
Thanks Dean.
That was an option I was hoping could be avoided. The development, testing and live environments are on different hosts. I was hoping my mind just wasn't experienced enough to recognize an obvious answer... other than trying to drag them to be at par with the free hosting sites available around the internet. It's still better than hand-coding a thousand pages.
-
11-05-2003, 04:10 AM #5
-
11-05-2003, 07:09 PM #6
-
06-10-2004, 05:38 PM #7
Hello,
I noticed your question about document.write and multilevel folders and links.
What I have done with a website is create a varible called "up" that is a text string.
For files in my subfolders, I have a locational variable that will be "true" and activate the "up" variable. For files not in subfolders, the locational variable will be false.
Then I put an if-statement in each folder. The if statement, using the locational variable, will assign "up" the string value "../" if my file is in a subfolder, or will be blank if the file is on the same level as the link target.
Similarly, I made a "down" variable that will be assigend a value such as "archive/" if the link target is in a subfolder called "archive" or will be blank if the file and link target are in the subfolder.
In my javascript, I place the "up" or "down" variables in front of my generic target like so:
document.write('<a href="'+up+'filename.html">Link</a>')
So, depending on your location, the variable will be blank or redirect links up or down your heirarchy.
I didn't put the appropriate arrows (<) on the link, because I didn't want it to actually turn into html in this message.
Hope this helps.
-
09-20-2004, 10:22 AM #8
You could also use '<base href="the/top/directory">' on your page. That way you'd only have to change this value when you move your pages from the test server to the live one.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum