Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > trying to document.write() a SSI

Reply
Thread Tools

trying to document.write() a SSI

 
 
Greg Brant
Guest
Posts: n/a
 
      01-29-2004
my script is

document.write("<!-- #include
virtual\"http://www.where-ever.com/whatevere.html\" -->")

but in the html (view source) i get

---------------------------------------------------
<script language="Javascript" type="text/Javascript">
document.write("\
-----------------------------------------------------
and thats the end of the document..

i also have some more document.write()'s above this in the same script
tag and these are not executed.. im guessing because it doesent get to
the </script> tag??

also im guessing that the reason its stopping is because its
encountering the html comment sequence "<!--".

so how do i write this safley?

cheers

Greg
 
Reply With Quote
 
 
 
 
Richard Formby
Guest
Posts: n/a
 
      01-29-2004

"Greg Brant" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> my script is
>
> document.write("<!-- #include
> virtual\"http://www.where-ever.com/whatevere.html\" -->")
>
> but in the html (view source) i get
>
> ---------------------------------------------------
> <script language="Javascript" type="text/Javascript">
> document.write("\
> -----------------------------------------------------
> and thats the end of the document..
>
> i also have some more document.write()'s above this in the same script
> tag and these are not executed.. im guessing because it doesent get to
> the </script> tag??
>
> also im guessing that the reason its stopping is because its
> encountering the html comment sequence "<!--".


It doesn't matter. Even if you got the script to work it wouldn't work. SSI
is done server side. That is why it is called Server Side include.

By the time your script gets to execute you are client side, no further
access to the server.



 
Reply With Quote
 
 
 
 
Greg Brant
Guest
Posts: n/a
 
      01-29-2004


any suggestions how can i do what im trying to achieve?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Richard Formby
Guest
Posts: n/a
 
      01-29-2004

"Greg Brant" <(E-Mail Removed)> wrote in message
news:4018f7df$0$70307$(E-Mail Removed)...
>
>
> any suggestions how can i do what im trying to achieve?


What exactly are you trying to achieve?


> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Hmmm.


 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      01-29-2004
In article <4018f7df$0$70307$(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
>
>
> any suggestions how can i do what im trying to achieve?
>


Assuming you're trying to include the content of one page within
another...
Use an IFRAME if you have no server-side language available (aside from
SSI).
If you have ASP or JSP, they can include pages in the output. I'm pretty
sure Perl can, too.

If you're trying to include pages only if some condition is true, and
that condition is determined on the client, you'll need javascript and
an IFRAME, as far as I know.

I'm out of ideas after that.

--
--
~kaeli~
If it's tourist season, why can't we shoot them?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-29-2004
"kaeli" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
<snip>
>Assuming you're trying to include the content of one page
>within another...
>Use an IFRAME if you have no server-side language available
>(aside from SSI).
>If you have ASP or JSP, they can include pages in the output.
>I'm pretty sure Perl can, too.
>
>If you're trying to include pages only if some condition is
>true, and that condition is determined on the client, you'll
>need javascript and an IFRAME, as far as I know.


The greater flexibility of server-side scripting aside, I can't see a
difference between:-

< some HTML >
<script type="text/javascript">
document.write("<!-- [SSI inserted HTML] -->");
document.write("something else");
</script>
< some more HTML>

- and:-

< some HTML >
<!-- [SSI inserted HTML] -->
<script type="text/javascript">
document.write("something else");
</script>
< some more HTML>

- Except that the latter is not JavaScript dependent and avoids having
to worry about the appropriateness of the characters within the include
in the context of a JavaScript string.

That is, if the point is to get the included HTML onto the page why not
include it in the HTML?

Richard.


 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      01-29-2004
In article <bvb7dl$hlh$1$(E-Mail Removed)>,
(E-Mail Removed) enlightened us with...
>
> The greater flexibility of server-side scripting aside, I can't see a
> difference between:-
>

<snip>

Me neither actually.
It's early.

>
> That is, if the point is to get the included HTML onto the page why not
> include it in the HTML?
>


I think the OP wanted the html included only if some condition were
satisfied. It was unclear if the condition was decided on the client or
on the server. Actually, the whole question was unclear. *heh*

--
--
~kaeli~
A plateau is a high form of flattery.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
Greg Brant
Guest
Posts: n/a
 
      01-29-2004


sorry fo being unclear.

The idea is that if a user has filled in a for then a page is included,
that page will take a variable posted from the form as an argument..

so.

the page to be included needs to process the variables and then be
included..

but i see that (obviously) SSI is server side..

I do have access to PHP so i am going to do it this way.. i was trying
to do it without php as a collegue is not proficient with the language

thanks for your response, somtimes the obvious is too obvious


cheers

Greg

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
@SM
Guest
Posts: n/a
 
      01-30-2004


Greg Brant a ecrit :
>
> sorry fo being unclear.
>
> The idea is that if a user has filled in a for then a page is included,
> that page will take a variable posted from the form as an argument..


you certainly can do that with JavaScript.

The form
<html>
<form action="js_read.html">
Give your Name :
<input type=text name="MyArgument">
<input type=submit value="GO">
</fomr></html>

to reach a specific page

js_read.html
<html>
<script type="text/javascript">
this.location.escape();
if(MyArgument!='') self.location='trucmuche/'+MyArgument+'.htm';
</script>
Sorry JavaScript error
</html>

to write in a page

js_read.html
<html>
<script type="text/javascript">
this.location.escape();
function dc(txt) { document.write(txt);}
if(MyArgument!='') trucmuche ='<h2>Hello '+MyArgument+'</h2>';
else trucmuche ='';
</script>
<body>
blabla
<script type="text/javascript">
dc(trucmuche);
</script>
re blah blah
</body>
</html>

and/or use ssi same way


--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : (E-Mail Removed)
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PC Power & Cooling Turbo-Cool 850 SSI Silverstrand Front Page News 8 10-15-2005 10:14 AM
Needing script alternative to SSI Xanathos Perl 0 02-02-2005 04:35 PM
Howto get the current file path with SSI Eranga Udesh ASP .Net 1 04-06-2004 05:18 AM
SSI Equivalent Bernardo Heynemann ASP .Net 1 12-01-2003 03:54 PM
Home-made SSI chips JJ VHDL 8 09-27-2003 03:51 PM



Advertisments