micahg Posted June 28, 2006 Share Posted June 28, 2006 Okay so it would be great if i could get this working properly. I have a little gallery script here that produced using a tutorial i found online. I modified it slightly and it works fine when i use tables. Now iam trying to switch to DIV's and have it place the thumbnail as the background image instead of having it place the thumbnails in a table with cells. It outputs all the correct HTML when you view the source so i have no idea what is going on. Any advice would be greatly appreciated. Here is a link to the page that i have been testing it on. [a href=\"http://www.micahg.com/art/arttest.php\" target=\"_blank\"]http://www.micahg.com/art/arttest.php[/a] and here is my php: <?PHP//initialize variables$data_file = "list.photos";$thumbnail_dir = "thumbs/";$photos = file($data_file);$total_photos = sizeof($photos);$i = 0; ?><div style="display:block; width:250px; height:300px;"><?PHP for($i=0; $i < $total_photos; $i+=2) { ?> <?PHP print("<div class=\"test\" style=\"background:url($thumbnail_dir$photos[$i]~.jpg)\"> <a href=\"javascript:photo_open('photo_display.php?start=".$i."','750','715');\"><img src\"../images/spacer.gif\" width=\"40\" height=\"40\"></a></div>\n"); ?> <?PHP } ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/13066-div-background-not-working/ Share on other sites More sharing options...
SharkBait Posted June 29, 2006 Share Posted June 29, 2006 This line: [code] <?PHP print("<div class=\"test\" style=\"background:url($thumbnail_dir$photos[$i]~.jpg)\">[/code]Should it not read:[code]<?phpprint("<div class=\"test\" style=\"background-image: url('{$thumbnail_dir}{$photos[$i]}~.jpg')\">[/code]I'm unsure about the ~ (tilde) mark but the rest should work as long as the thumbnail is in thumbs/nameofphoto.jpg Quote Link to comment https://forums.phpfreaks.com/topic/13066-div-background-not-working/#findComment-50825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.