Results 1 to 6 of 6

Thread: shtml

  1. #1
    Join Date
    Apr 2007
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default shtml

    is is possible use javascript to write in shtml (<!--#include virtual="...)?
    I'm using a small javascript to write in info location (document.writeIn)..

    This is what I've been trying to use but it is not working:

    function lid.markaskor.pr()
    {
    var paramValue;
    var param2Value;

    if( paramValue=window.location.search.match(/[?&]year=(\w+)/) )
    document.write('<!--#include virtual="cgi-bin/?info=.');
    document.write( paramValue[1] );
    if( param2Value=window.location.search.match(/[?&]team=(\w+)/) )
    document.write('&search=');
    document.write( param2Value[1] );
    document.write('" -->');
    }

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it isn't possible, since the code is executed server-side before the Javascript is even sent to the browser. Even if it could be done (which it probably can with some escaping of quotes server-side, but I don't think SSI is capable of this and it would be horribly inefficient anyway because you'd have to load all the pages into the client's memory) it shouldn't be. There's no reason the above code can't be done entirely server-side.

    lid.markaskor.pr is also an invalid function name. You could do:
    Code:
    window['lid.markaskor.pr'] = function() {
      /* ... code ... */
    };
    
    // and call it like:
    window['lid.markaskor.pr']();
    or:
    Code:
    var lid = {
      markaskor : {
        pr : function() {
          /* ... code ... */
        }
      }
    };
    
    // and call it like:
    lid.markaskor.pr();
    but not:
    Code:
    function lid.markaskor.pr() {
      /* ... code ... */
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Apr 2007
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    could you show me how?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    As I said, I don't believe SSI is capable of it. You'd need a fully-fledged server-side language.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Apr 2007
    Posts
    26
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Do you know of a way that I can get information from the location URL (..?info1=file1&info2=file2) into the <!--#include virtual="URL" -->?
    so I can use fewer template files..

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Sure. Use PHP. (Or ASP, JSP, some other form of CGI, such as PERL, python, etc.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •