View Full Version : Including images in a div
ajwart1
08-23-2006, 08:44 PM
I'm working on a gallery website ( http://angwat.freehostia.com ) and I'm trying to do what I thought would be a simple task: I want to include an image into the main div layer, the big light one, when a thumbnail is clicked in the green space to the left.
I tried to do this using case/switch includes as I had for the pages themselves, but they don't seem to be working. I based the image code off of the tutorial I found here, http://www.digital-web.com/articles/easypeasy_php/, but I haven't had any success. So, after messing with it for a week I admit defeat and turn to you wise folks here for help.
erisco
08-23-2006, 08:56 PM
Your code would be helpful.
ajwart1
08-23-2006, 08:57 PM
Here's the code for the index, the page I'm having trouble with. The illustration and sketches pages are both HTML, so the code should show when they're included.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The Art of Ashlee J. Williams</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src='java.js' type='text/javascript'></script>
</head>
<body style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">
<div id="dogs">
<?php
if (!isset($_GET['page'])) $page= 'default'; else $page= $_GET['page'];
switch($page)
{
case 'resume':include ('resume.html');break;
case 'contact':include ('contact.html');break;
case 'main':include ('main.php');break;
default:
echo
"<p>Welcome to AJWart.com! My name is Ashlee; I'm a Savannah College of Art and Design sophomore who is seeking freelance work in illustration. I'm also open for commisions, so feel free to contact me in regards to that. Thank you for stopping by.</p>";break;
}
?>
<?php switch($_GET[$id])
{
case 'nakedlady1':
echo ('images/nakedlady1.png');
break;
case 'theodin':
echo ("<img src=\"images/theodin.png\" alt=\"\" /><br /><h2>Done for a weekly contest on Conceptart.org</h2>");
break;
case 'mwar':
echo ("<img src=\"images/mwar.png\" alt=\"\" /><br /><h2>Red House</h2>");
break;
case 'lifedrawing':
echo ("<img src=\"images/figure1.png\" alt=\"Image of a brown bear\" /><br /><h2>Brown bear</h2>");
break;
case 'chickgirl':
echo ("<img src=\"images/chickgirl.png\" alt=\"Girl with Baby Chick\" /><br /><h2>The dress was inspired by one at my school's fashion show.</h2>");
}
?>
</div>
<div id="cats">
<?php
if (!isset($_GET['page'])) $page= 'illustration'; else $page= $_GET['page'];
switch($page)
{
case 'illustration':include ('illustration.html');break;
case 'sketches':include ('sketches.html');break;
default:
echo
"Navigate for thumbnails.";break;
}
?>
</div>
<?php
include("footer.html");
?>
</body>
</html>
erisco
08-23-2006, 09:11 PM
Last edited by Peg?... Maybe she is going to post before I hit submit on this message :P
I don't see where the issue is occuring though. I don't fully understand how your page is working... could you explain a bit more from including these files to clicking on the thumbnails?
Pegasus
08-23-2006, 09:17 PM
Sorry. I just put the PHP code in so that it was easier to read.
Peg
ajwart1
08-23-2006, 09:39 PM
The problem is that even though I used the same method of including the images into the main div as I did including the links into the main div (only with echo and ID instead of case and page get), when I click on a thumbnail image all the page does is re-load; the image never appears. I can't understand what the problem could be; I don't know if the image is appearing behind the div ( I had that problem with the text at first) or if there's some coding error I'm just not seeing. I'm very new at PHP, so whenever something goes wrong I feel a bit in over my head-- and to think, I picked it because I thought it would be an easier way to build my site! :doh:
EDIT: I fixed the problem with my menu pages not including; I forgot to change include.php to index.php in the footer HTMl when I uploaded it. The problem with my images not including still remains however, so any ideas would be appreciated. I'm beyond stumped at this point.
ajwart1
08-26-2006, 12:53 AM
Anyone...? I've tried fiddling with it some more, but I'm still stuck.
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.