Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2   Go Down
Print
Author Topic: SSI via Javascript  (Read 2023 times)
0 Members and 1 Guest are viewing this topic.
memobug
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: December 29, 2001, 04:55:00 AM »

I found a cgi program online that will let you get a SSI Server Side Includes CGI EXEC effect with just a Javascript link.

You install the executer.cgi script from www.smartcgis.com  in your cgi-bin, and then you can include the results of many cgi scripts right in your standard html and cgi pages.  It's working pretty well for me with the calendarscript.

A couple neat things about it with respect to the calendar is that it can cache results for a configurable amount of time, so your calendar.pl wouldn't be getting hammered as often unnecessarily. For example, if you have a 30 day list of events showing in your webpage, you could set the cache period to an hour or two.

PLUS...it appears to support command line arguments, so you can pass templates and arguments to it, which gets around some of the limitations of the SSI method.  I'm passing a template at least, so I suppose you could pass some other arguments to get different displays or calendars to show.

Regards,

Matt

Logged

Regards,

Matt

yullah
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #1 on: February 24, 2003, 01:43:00 PM »

that's a great tip! I downloaded the executer, and have tried to run it with my calendar, but there seems to be a minor glitch in the code somehow- i get document.writeln(' '); all over the place...

here's a link to what i'd like to include with the JS tags...(see output below) http://www.yullah.com/cgi-local/executer.cgi?http://www.yullah. com/cgi-local/calendar.pl?template=weekssi.shtml
--
and of course here's what i'd expect it to look like: http://www.yullah.com/cgi-local/calendar.pl?template=weekssi.shtml
--
it seems like a simple syntax issue, the script is just printing the JS stuff that shouldn't be showing up... anyone have any suggestions?
--

p.s. otherwise, the JS code i run,
<script src="http://www.yullah.com/cgi-local/executer.cgi?http://www.yullah.com/cgi-local/calendar.pl?template=weekssi.shtml"></script>
just doesn't run in my html pages, i get a javascript error and nothing shows up where the script info should be...
_______________________________________________

document.writeln(' '); document.writeln(' '); document.writeln('
'); document.writeln(' '); document.writeln(' '); document.writeln(''); document.writeln('  '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln('  '); document.writeln(' Monday, February 24 '); document.writeln('  '); document.writeln('  
'); document.writeln('  '); document.writeln('  Location '); document.writeln('  Event '); document.writeln('  
'); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln('  '); document.writeln('  Washington, DC '); document.writeln('  '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' The Evolving Status of Women in the Arab World: Culture, Faith, and Law '); document.writeln(' '); document.writeln('  
'); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln('  '); document.writeln(' Tuesday, February 25 '); document.writeln('  '); document.writeln('  
'); document.writeln('  '); document.writeln('  Location '); document.writeln('  Event '); document.writeln('  
'); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln('  '); document.writeln('  Washington, DC '); document.writeln('  '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' Films @ Center for Policy Analysis on Palestine '); document.writeln(' '); document.writeln('  
'); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln(' '); document.writeln('  '); document.writeln('  
'); document.writeln('

Powered by Smart CGIs
');

------------------

[This message has been edited by yullah (edited February 24, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #2 on: February 24, 2003, 05:07:00 PM »

 
quote:
but there seems to be a minor glitch in the code somehow- i get document.writeln(' '); all over the place... the script is just printing the JS stuff that shouldn't be showing up...
That script just goes through the CalendarScript output and puts each line inside a
document.writeln('... JavaScript statement.

If you look at the calendar's output source code, you'll see there are an enormous number of blank lines. Each document.writeln(' '); statement will correspond to one of them which should not effect the operation of it.

Dan O.


[This message has been edited by DanO (edited February 24, 2003).]

Logged
yullah
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: February 24, 2003, 06:16:00 PM »

thanks DanO,
I've been fiddling with this script, and it has me baffled...

for some reason when i use

code:
<script src="http://www.yullah.com/cgi-local/executer.cgi?http://www.yullah.com/cgi-local/calendar.pl?template=ssi.html">
</script>

it only works if the ssi.html is set to "&getEvents( {'duration'=>$in{duration}} );"

code:

<%
&getEvents( {'duration'=>$in{duration}} );
$DAY = $Grid->{'grid'}->
  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    %>
    <DL>
    <%FOREACH EVENTLIST%>
       <%IF EVENTS EXIST%>
       <%$total_events++;%>
       <DT><%=$DAY->{dayname}%>, <%=$DAY->{monthname}%> <%=$DAY->{dd}%>
       <DD>
          <%FOREACH EVENT%>
             •
             <% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= $EVENT->{'schedule'}->{'start_time'} %><% } %>
             <% if ($EVENT->{'schedule'}->{'end_time'}) { %>-<%= $EVENT->{'schedule'}->{'end_time'} %><% } %>
             <% if ($EVENT->{'schedule'}->{'start_time'}) { %> : <% } %>
             <%= $EVENT->{'details'}->{'title'} %><BR>
          <%/FOREACH%>
       <%/IF%>
    <%/FOREACH%>
    </DL>
    <%unless($total_events){%>
    <CENTER><I>No Events</I></CENTER>
    <% } %>
    <A HREF="<%=$AdminConfig->get("calendar_url")%>?calendar=<%=$calendar_key%>">View Calendar</A>

when i change the top part of the code to

code:

<%
&getEvents( {'duration'=>'3d'} );
$DAY = $Grid->{'grid'}->
  • ->
  • ;
    $EVENTS = $DAY->{events};
    $total_events=0;
    %>


  • it only returns a javascript error. actually any changes i make to seem to ssi.html return javascript errors...

    this also happens if i point to any other template file other than ssi.html (i.e. weekssi.html)

    I would like to include weekssi.html or .shtml with this script but i have no CLUE why it's not working. (i'm currently calling weekssi.shtml on my home page http://www.yullah.com  using SSI but i'd like to be able to call it from remote servers.

    i don't know if it makes any difference, but my ssi.txt is set to

    code:

    template=ssi.shtml
    duration=5d


    it doesn't seem to have any effect at all on the SSI on my home page...

    I've been at this for like 7 hours straight and can't find an answer- I know it may not be directly a calendarscript issue, but to the extent that it might be, i'm hoping someone can help de-bug my brain a little bit here...

    also i know you guys really know your stuff and any advice is really appreciated!!!

    thanks in advance!!!

    ------------------

    [This message has been edited by yullah (edited February 24, 2003).]

    Logged
    DanO
    Moderator
    Full Member
    *****

    Karma: 13
    Offline Offline

    Posts: 230

    Please don't PM me. Post in the open forum.


    WWW
    « Reply #4 on: February 24, 2003, 07:58:00 PM »

    ** i don't know if it makes any difference, but my ssi.txt is set to  **

    The ssi.txt file will only be referenced when calendar.pl file is really called via SSI. Otherwise you'll have to pass all of the variables you want used in the call to it. Eg.
    http://www.yullah.com/cgi-local/calendar.pl?template=weekssi.shtml&duration=5d&  calendar=default

    (You may not need the &calendar=default if you're just displaying the default calendar's events.)

    I don't know why it's generating JavaScript errors, maybe you could ask the executer script's author for assistance? Although, it may have something to do with the javaScript code you have in the weekssi.shtml file.

    Dan O.


    [This message has been edited by DanO (edited February 24, 2003).]

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #5 on: February 24, 2003, 09:36:00 PM »

     
    quote:
    Although, it may have something to do with the javaScript code you have in the weekssi.shtml file.

    the strange thing is that when i edit ssi.html to call 3days of events, it gives me the same error. it's like any changes made to ssi.html give an error, so i was thinking maybe there's something magical about that file name - that it;s called somewhere else or refernced somehow in a way that will give me errors if it's edited...

    anyway i guess i'll have to give up on this one for now...

    but if anyone has the solution i'll pay you!!! :-)

    thanks for your help DanO!

    ------------------

    Logged
    DanO
    Moderator
    Full Member
    *****

    Karma: 13
    Offline Offline

    Posts: 230

    Please don't PM me. Post in the open forum.


    WWW
    « Reply #6 on: February 24, 2003, 09:40:00 PM »

    ** the strange thing is that when i edit ssi.html to call 3 days of events **

    You don't have to edit the template file just to call a different number of days. As I stated, you just pass that information in the query string.

    Good luck.

    Dan O.

    ------------------

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #7 on: February 24, 2003, 10:06:00 PM »

     http://www.yullah.com/cgi-local/calendar.pl?template=ssi.html&duration=3d  
    http://www.yullah.com/cgi-local/calendar.pl?template=weekssi.shtml  

    Thanks for the tip on that duration bit DanO- that did help a bit...

    my concern though is that i want to edit ssi.html further, more than just the change in duration, to format and allow the events to be linked to the details page...

    (compare the two links above)

    i did take the javascript out of weekssi.shtml, and i still get those errors.

    anyway thanks again for your help, i do appreciate it!

    maybe some things just aren't meant to be i guess :-)

    ------------------


    [This message has been edited by yullah (edited February 24, 2003).]

    [This message has been edited by yullah (edited February 24, 2003).]

    Logged
    DanO
    Moderator
    Full Member
    *****

    Karma: 13
    Offline Offline

    Posts: 230

    Please don't PM me. Post in the open forum.


    WWW
    « Reply #8 on: February 25, 2003, 06:08:00 PM »

    I don't know if this is the problem but that CGI script you're using appears to be creating output like:

    code:
    document.writeln('<!--#include virtual="/cgi-local/calendar.pl?template=weekssi.shtml" -->
    ');

    As far as I'm aware, all Javascript statements should be on a single line like:

    code:
    document.writeln('<!--#include virtual="/cgi-local/calendar.pl?template=weekssi.shtml" -->');

    You'd have to contact that script's author about that.

    Dan O.

    ------------------

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #9 on: February 26, 2003, 01:58:00 PM »

    well, here's the response the executer script's author finally gave me...
    quote:

    You definitely can't grab SSI tags with it.
    It just doesn't work well with complicated html either. I will tryt o improve it by the next version.

    memobug i don't know how you got this to work but i'd love to get a look at some of your code!!!

    thanks DanO for your help...

    ------------------

    Logged
    DanO
    Moderator
    Full Member
    *****

    Karma: 13
    Offline Offline

    Posts: 230

    Please don't PM me. Post in the open forum.


    WWW
    « Reply #10 on: February 26, 2003, 06:32:00 PM »

    ** You definitely can't grab SSI tags with it. **

    Were you expecting to? That's not the purpose of the script.

    Dan O.

    ------------------

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #11 on: February 27, 2003, 01:10:00 PM »

     
    quote:

    ** You definitely can't grab SSI tags with it. **
    Were you expecting to? That's not the purpose of the script.

    yeah, I know that, and you know that, but the author of the script wasn't too helpful. I gave him a ton of information and he came back with this answer.

    what i *was* expecting it to do was work as memobug got it to do...

    quote:
    I found a cgi program online that will let you get a SSI Server Side Includes CGI EXEC effect with just a Javascript link.

    i expected it to be able to grab info from the calendar script / template to post to other pages.

    but, no such luck there.

    was i inaccurate in my expectations?

    ------------------

    Logged
    DanO
    Moderator
    Full Member
    *****

    Karma: 13
    Offline Offline

    Posts: 230

    Please don't PM me. Post in the open forum.


    WWW
    « Reply #12 on: February 28, 2003, 02:37:00 PM »

    ** i expected it to be able to grab info from the calendar script / template to post to other pages **

    Sounds right unfortunately I guess the code you asked him to look at had an SSI tag in it and that confused things?

    Did you point out to him about the JavaScript tags being printed on 2 lines instead of just one?

    Dan O.

    BTW. If you can't get it to work, can you not just display the SSI template's output in an iframe tag on your other site?

    ------------------

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #13 on: March 02, 2003, 07:36:00 PM »

     
    quote:
    Did you point out to him about the JavaScript tags being printed on 2 lines instead of just one?

    yeah i did point that out...

    i've pretty much given up on using that method though.

    I've never been a big fan of frames, but that might be worth a shot- is the iframe tag difft from regular frames?

    i'd like to be able to display a line or two of code that webmasters can add to thier sites to display a few days of events on thier webpage that will link back to my calendar...

    maybe frames will be the only way to do this, but it doesn't seem very efficient to have a scrolling list of events at the top / bottom / side of a site, as much as it would integrated into the rest of thier content...

    i'm off to do some research on this method, thanks for the tip!!!

    (if you can point me to a resource with more info on iframes it would be appreciated!)

    thanks!!!

    ------------------

    Logged
    yullah
    New Member
    *

    Karma: 0
    Offline Offline

    Posts: 0


    WWW
    « Reply #14 on: March 02, 2003, 07:54:00 PM »

    OK i think i got it :-)

    using

    <iframe src="/cgi-bin/calendar.pl">
    <ilayer src="/cgi-bin/calendar.pl">
    </ilayer>
    <nolayer>
    <a href="/cgi-bin/calendar.pl">calendar</a>
    </nolayer>
    </iframe>

    from the following post...
    http://www.calendarscript.com/support/forum/Forum5/HTML/000102.html

    it seems to be working pretty well. i hope this will work cross browser etc...

    Thanks so much for all your help!!!

    ------------------

    Logged
    Pages: [1] 2   Go Up
    Print
    Jump to: