caption under images
Posted: Sun Sep 04, 2011 8:43 pm
Hello,
i am trying with all my knowledge about php and tutorials on the internet to make that there are captions under all images. Because there is not much of both(although my knowledge about php is increasing slowly) i can't get the captions under the images.
I am this far;
Thanks in advance
i am trying with all my knowledge about php and tutorials on the internet to make that there are captions under all images. Because there is not much of both(although my knowledge about php is increasing slowly) i can't get the captions under the images.
I am this far;
<body> <div id="wrap"> <div id="sidebarleft"> <?php foreach ($images as $image){ if (file_exists("./thumbs/{$image}")){ echo "<a href='?full_img={$image}'><img src='thumbs/{$image}' alt='{$image}' /></a>"; }else{ echo "<a href='?full_img={$image}'><img src='?img={$image}' alt='{$image}' /></a>"; } } ?> </div> <div id="image"> <?php if (isset($_GET['full_img'])){ echo '<a href="?full_img={$image}"><img src="', htmlentities($_GET['full_img']), '" alt="{$image}" /></a>'; } ?> <div id="caption"> <?php function _applyCaption($image){ if(isset($_GET['caption'])){ $caption = $_GET['caption']; $words = split(" ", $caption); $new_caption = array(); $new_caption_str = ""; foreach($words as $word){ if(!isset($new_caption[$line])) $line++; $new_caption[$line] = ""; $new_caption[$line].= $word." "; } } } ?> </div> </div> </div> </div> </body>I hope it make any sense and that i am on the right track, but nothing appears under the images yet. Hopefully someone can help me.
Thanks in advance