Author Topic: Using Server Side Includes (SSI)  (Read 18056 times)

0 Members and 2 Guests are viewing this topic.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Using Server Side Includes (SSI)
« on: November 19, 2002, 10:01:59 »
As part of album.pl, you can incorporate bits and pieces of your album into other pages. In each case below, the output is generated without header, footer or style info, so the HTML can be inserted directly into an existing page. (See http://perl.cdnarmy.ca/album, under Pic Randomizer for an example.)

Here are the "SSI" enabled calls:

View the 10 most recent uploads, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?album=:recent;ssi=10

View a randomly selected photo, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?random=1;ssi=2

View the thumbnail of a randomly selected photo, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?random=1;ssi=1

View randomly selected photos in a slideshow (5 second delay), formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?random=1;ssi=2;slideshow=5

View the thumbnails of randomly selected photos in a slideshow (5 second delay), formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?random=1;ssi=1;slideshow=5

View a specific photo, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?photo=photoname;ssi=1

View photos in a slideshow (5 second delay), formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?photo=photoname;slideshow=5;ssi=1

View randomly selected photo directly (no HTML, just the image itself):
 http://perl.Bobbitt.ca/cgi-bin/album.pl?image=random

View randomly selected thumbnail directly (no HTML, just the thumbnail itself):
 http://perl.Bobbitt.ca/cgi-bin/album.pl?image=randthumb

View thumbnails of 10 most popular photos, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?popular=1;ssi=10

View thumbnails of 10 most popular albums, formatted for inclusion in other pages:
 http://perl.Bobbitt.ca/cgi-bin/album.pl?popular=2;ssi=10

In PHP, you can do the same thing like this:

Code: [Select]
<?php include "http://perl.cdnarmy.ca/cgi-bin/album.pl?album=:recent;ssi=10" ?>
And in standard HTML, you can use inline frames:

Code: [Select]
<IFRAME src="/cgi-bin/album.pl?album=:recent;ssi=10" width="200" height="800" scrolling="no" frameborder="0">
Your browser does not support frames.
</IFRAME>

Here's an SSI example of the same:

Code: [Select]
<!--#include virtual="/cgi-bin/album.pl?album=:recent;ssi=10"-->
You can also make direct calls to the "image" generation URLS:

Code: [Select]
<img src="http://perl.Bobbitt.ca/cgi-bin/album.pl?image=random">
<img src="http://perl.Bobbitt.ca/cgi-bin/album.pl?image=randthumb">
« Last Edit: October 22, 2004, 13:06:54 by Mike Bobbitt »

Offline Dino

  • album.pl Donor
  • I Spend Too Much Time Here
  • *****
  • Posts: 250
  • Karma: +5/-0
  • That's actually my childhood cookie jar!
    • Dino's Bulletin Board
Re:Using Server Side Includes (SSI)
« Reply #1 on: February 18, 2003, 15:32:18 »
Wow! I just noticed here that you mentioned iframes with SSI! I must have ESP! Great minds think alike... or something like that....

"He who seeks the truth must doubt everything."Aristotle
"Extraordinary claims require extraordinary proof."Sagan

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #2 on: March 27, 2003, 13:36:08 »
Is there any way to get the <IFRAME> method sized down to the same size as the thumbnail image so that there is no grey/dark grey (default css colors) background colors?
~Shawn

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:Using Server Side Includes (SSI)
« Reply #3 on: March 27, 2003, 13:55:26 »
Sure, just set the iframe size to be your thumbnail size. If you have multiple sizes however, that would be a problem...

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #4 on: March 27, 2003, 14:11:53 »
<<Sorry, it clips and pushes the image to the lower-right corner. But still clips.>>

k, that was the first thing I tried, but it offsets the image to the <lower-right> corner and so the thumbnail gets clipped and you still see some of the css colored background.

<iframe src=xxxxxx width="100" height="75" scrolling="no" frameborder="0">

This is what I have already tried. Are there some <iframe> options I am overlooking?

Is there somewhere in the css or other album.pl files that create som kind of indents that might affect this ssi call?
« Last Edit: March 27, 2003, 14:28:33 by xenon2000 »
~Shawn

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #5 on: March 27, 2003, 14:40:02 »
Adding
marginwidth="0" marginheight="0"

Helped a little, the image now lines up to the top. But it still has a left grey gap.
~Shawn

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #6 on: March 27, 2003, 15:13:13 »
When searching through your code, I notice a lot of
align=right
Is there a specific align=right that only affects this call? I suspect that is what is causing the offset gap on the left for me.
~Shawn

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:Using Server Side Includes (SSI)
« Reply #7 on: March 27, 2003, 15:58:58 »
What's the URL you're trying to get? I.E. xxx/album.pl?ssi=1;album=:recent

The "where" depends on how you're invoking album.pl...

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #8 on: March 27, 2003, 17:38:46 »
I should have posted that I was using:
http://xxxxxxxxxxxx/cgi-bin/album.pl?album=:recent;ssi=10
instead of:
http://xxxxxxxxxxxx/cgi-bin/album.pl?random;ssi=1

Which the random funtion works fine. So that was a big mistake on my part. Sorry, I have been looking at so many bits of other peoples code for the past 3 days. Thanks for the help.
~Shawn

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #9 on: March 27, 2003, 17:43:24 »
  I do have this question to ask about the random pic SSI (and the other pic ssi calls).
  I have just made an test.html file that makes the call to a random pic and that works, but when I click on the thumbnail, it opens the gallery within that little <iframe>.
~Shawn

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:Using Server Side Includes (SSI)
« Reply #10 on: March 27, 2003, 20:12:41 »
There's info on making it open up into the main browser window here:

http://perl.bobbitt.ca/yabbse/index.php?board=4;action=display;threadid=606;start=0

Also, you'll want to change the .ssirecentuploads class in Photo_Album.css to change the style of the recent uploads SSI. (Including spacing, background, etc...)

Cheers

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #11 on: April 04, 2003, 02:31:08 »
I was wondering? How does it "randomly" pick an image? It my case, it seems to pick from one album a lot more often than the other 2 out of 3 albums. I was wondering how it chooses what to pick and how I might be able to make it a little more evenly random from multiple albums (subfolders).
~Shawn

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:Using Server Side Includes (SSI)
« Reply #12 on: April 04, 2003, 09:24:12 »
It catalogs every photo in all albums and then uses a random function to pick one.

So if one album has half your photos by number (50 of 100 total) then photos from that album will show up half the time...

Offline xenon2000

  • album.pl Tester
  • **
  • Posts: 47
  • Karma: +0/-0
  • Photo galleries rock!
    • PicturesForTheBlind.com
Re:Using Server Side Includes (SSI)
« Reply #13 on: April 07, 2003, 12:10:06 »
hmmm, ok, that makes sense. I wonder how hard it would be to create a method where it cycles through each gallery ie (1, 2, 3, 1, 2, 3.....) and then pick a random image. Instead of just treating all the albums as one list and picking random from that. I know that for most purposes your single file method would be best, but I am trying to give a more equal share of showing from each of my artist albums. Do you think it would be hard for me to go in and modify it so that it creates a list of images by album set, and then have it pick an album first in cycled sequence and then have it perform your random pick?
~Shawn

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:Using Server Side Includes (SSI)
« Reply #14 on: April 07, 2003, 12:42:27 »
It would definitely be a change... Instead of recursing all directorys and just heaping the photos onto a list, you'd have to track photos by album. Then pick an album and then a photo, as opposed to picking just a photo.

Certainly possible, but changes would be needed...