Popup script available for download

domesticat's picture
in

Please note that this code has been updated. See this entry for the updated version.

After a couple of inquiries, I decided to make my new PHP/javascript toy available. The script I used to do the image popups (without needing a HTML file for each picture) is a modification of a script originally written by Anarchos, which needed some tidying and changing before I was happy with it. A copy of my modification of the original script, plus a bit of direction on how to use it, is available here. (a 2k .zip file)

Believe me—if you were faced with creating 700-plus static HTML files just so that you could display popups, you'd go digging for a script, too.

(Thanks again to Gareth for zapping the code into shape, and Scott for the right suggestion at the right time.)

Comments

i know this is an ancient post, but i seemed to remember seeing it here. thank you!

I see beautiful pop menus in http://lucent.com nice layout, easy navigating. In the source I don't understand the point, where popup (1) , popup (3) and popup (4) stand for. Can you help me? My sites: http://siopel.org http://artsenverbond.nl Thenk you / CR Staalman

domesticat's picture
The Lucent site uses popup menus, a very different thing. This script is to pop images up in a separate window without having to create a static HTML page for each one. Sorry.

I was looking at this code Amy, as I put something similar together for my photo page and wanted to see how you do it. It seems a bit too javascript-centric to me, no? I think it all depends on how much info you want to transfer in the URL, but this way the window won't popup tiny and then resize itself. You could setup something like this, (I'm sure it can be customized to make it much more user friendly) defining a new function: Line breaks on the 'print' line are mine. Take them back out. This is just for display purposes. <? function popup($file, $title) ( $path = "http://www.yoursite.com"; $size = getimagesize("$path$file"); $width = $size[0]; $height = $size[1]; print "<a href=\"#\" onclick=\"window.open ('http://www.yoursite.com/pathto/popup.php?z= $path$file&width=$width&height=$height& title=$title','photopopup','width=$width,height=$height,directories=no, location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no, screenx=50,screeny=50');return false\">$title</a>"; ) ?> And then it can be called like this: <? popup("/path/to/file.jpg","Description of Picture"); ?> The popup.php doesn't need to be anything more than a normal HTML page, with all the margins set to 0 and an echo line something like this: <? echo "<img src=\"$z\" width=\"$width\" height=\"$height\" border=\"0\" alt=\"$title\" />"; ?> Sorry if I'm stepping on toes here. I always like going with PHP in favor of javascript because javascript is so client-side and here the only javascript used is the normal window.open, which most browsers can handle without a problem. --- By the way - THANK YOU Amy. You got me started with PHP way back with the skinning and I've done nothing but learn since. It's too cool not to learn. ;) Have a great day.

domesticat's picture
Lynda - no toes stepped on at all! I've already emailed you to tell you this, but this is a script I've wanted to revisit for a while. I've known there were problems with it, but other things took precedence. I suspect you just eliminated some work on my part. I'm ALL about that. :)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><s><blockquote><br><br /><p>
  • Lines and paragraphs break automatically.
  • Insert Flickr images: [flickr-photo:id=230452326,size=s] or [flickr-photoset:id=72157594262419167,size=m].
  • Textual smileys will be replaced with graphical ones.
  • Each email address will be obfuscated in a human readble fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options

Syndicate content

Things you didn't know you needed

powered by Drupal Atom feed, entries RSS feed, entries RSS feed, comments my music habits on last.fm my photos on flickr my bookmarks on del.icio.us my bookshelves what I'm reading

Recent comments