|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am trying to use JS to include some files in a cgi script. I have tried both: <script language="javascript"> <!-- document.write("http://www.domain.com/nav_side_main_home.inc"); // --> </script> and <script language="javascript"> <!-- document.write("<!--#include virtual="../nav_side_main_home.inc" -->"); // --> </script> In both cases all that prints is the URL and not the file. Can anyone offer assistance? Art |
|
#2
|
|||
|
|||
|
Of course, in the first instance Javascript is just dealing with a text string. the only way to get java to write the CONTENTS of the file there is to make 1 or more variables out of the whole contents of the include file, and then have javascript write out those variables--it can be done (in IE, at least), but what a messy solution.
In the second section I believe the server will not parse the include as long as it is inside the <script> tags or the parentheses. But even so, again you cannot just do document.write and spew regular HTML (with carriage returns, etc...) in there and expect Javascript to deal with it. I misunderstand why you even need javascript at all, though. Shouldn't a standard include to the trick, if you just want HTML from another file written inside this file? Please explain your needs a little more clearly. |
|
#3
|
|||
|
|||
|
Thank you for your help.
What I am trying to do is the following. I have a cgi search script. Results are yielded by mereging data with an html template. I can design the template however I like because it is just html. When results are shown on the screen, the url is search.cgi. Because it is a cgi my ssi's do not work. I need a way to structure the ssi's within a cgi. As a side note I have also placed a .htacess file in my dir and tried the following: AddHandler cgi-script .html AddType text/x-server-parsed-html .html The cgi works but still no ssi. Thank you for any help you can lend. Art [This message has been edited by artfold (edited March 20, 2000).] |
|
#4
|
|||
|
|||
|
Well, my expertise is with PHP and ASP, so I don't know how much help I can be, but in my PHP and ASP, for example, there is a built-in include method: include(), that let's me include any HTML I want to be output along with the server-generated code. If you are using Perl, I am sure there is a way. It might be a little more complicated, like using a command to open the file and read the contents into a variable, and then printf that variable into the perl output.
It really should be done with your server-side code, is my point. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > SSI and JS? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|