PDA

View Full Version : can't figure out how to add text to this div!!!


deafboyzaudio
11-30-2009, 10:37 PM
I have a pic gallery that is generated by php and displayed with JS.
I want to know how to add text to the div called "div.fancy_bg_s". It is at the bottom of each pic when it is viewed fullsize.

My problem is since it is displayed by JS i have no idea how to insert text into it.. I can change the colors with css and have searched the JS file for references to that div... its only referenced in one spot.... i didnt think adding text here would work and guess what???? it doesnt:x. here is the code anyways

$.fn.fancybox.init = function() {
if (!$('#fancy_wrap').length) {
$('<div id="fancy_wrap"><div id="fancy_loading"><div></div></div><div id="fancy_outer"><div id="fancy_inner"><div id="fancy_nav"></div><div id="fancy_close"></div><div id="fancy_content"></div><div id="fancy_title"></div></div></div></div>').appendTo("body");
$('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#fancy_inner");If you want to see the gallery its at www.deafboyzaudio.com/pics.php (http://www.deafboyzaudio.com/pics.php)

Basically i'm trying to add a dynamically generated caption to each pic thats uploaded to my site, if anyone knows how to add dynamic php code to a div displayed by a JS gallery, PLEASE TELL:confused:
Thank you

edbr
12-01-2009, 12:58 AM
yu will have to look at how the php returns the image it must be looping though a database and echoing the result , the text will need to be also in the database and returned in the same way . i cant say from this code how it has been done

deafboyzaudio
12-01-2009, 05:38 PM
right now all the images are stored in an uploads folder. It loops through that folder and desplays the images.
I am designing my database right now and I guess that I want it to loop individual folders like 'randomn' and 'featured' and then pull the attached data from the database. I'm sure this is possible.... im just not sure how but I have an idea of the right direction now. My code is this...
<?php

/* settings */
$image_dir = 'images/upload/';
$per_column = 5;


/* step one: read directory, make array of files */
if ($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..')
{
if(strstr($file,'-thumb'))
{
$files[] = $file;
}
}
}
closedir($handle);
}

/* step two: loop through, format gallery */
if(count($files))
{
foreach($files as $file)
{
$count++;
echo '<a class="photo-link" rel="one-big-group" href="',$image_dir,str_replace('-thumb','',$file),'"><img src="',$image_dir,$file,'" width="100" height="75" /></a>';
if($count % $per_column == 0) { echo '<div class="clear"></div>'; }
}
}
else
{
echo '<p>There are no images in this gallery.</p>';
}

?>

edbr
12-02-2009, 01:54 AM
perhaps if in a database you have image name and caption ,then you could echo based on a match between image name .