forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: apexweb on August 23, 2004, 09:51:24 pm

Title: How to add SQL fields to slide show?
Post by: apexweb on August 23, 2004, 09:51:24 pm
My goal is to add {TITLE} and {CAPTION} fields to this slide show http://naturalwaterslide.com/photos/displayimage.php?album=9&pid=4&slideshow=5000

(All abums & photos, not just this one!)  ;D

??? I could not find it in FAQ, nor find it in code (seems to have to do with template_eval function), nor Google it, nor find it on this forum (yet).

Anyone able to help?

Thanks,
Title: Re: How to add SQL fields to slide show?
Post by: Joachim Müller on August 23, 2004, 10:38:15 pm
hasn't been coded yet, you will have to modify the JavaScript (script.js) and some php bits (not sure it will work with the JavaScript coppermine currently uses anyway).

GauGau
Title: Re: How to add SQL fields to slide show?
Post by: apexweb on August 24, 2004, 05:44:52 pm
Thanks for the help, GauGau.

I'm trying here, but need some more help.   ??? 

Can anyone give me some tips -- maybe what to change, or maybe point out some resources (advanced PHP tutorials)?  I'd like to figure it out, but I'm just not seeing it in the PHP and especially don't see what the cookie (in JS) would do to put {TITLE} and {CAPTION} fields on the displayimage.php?slideshow=9999 page.  Thanks again.

This is for CM 1.2.1.

Free domain name for 1 year, for first person to explain exactly what is needed here (after it works).  Really free -- you can transfer or host it elsewhere if you want.  (I'd better go make sure it's OK to do that... ;D Please tell me if I need to delete it.)
Title: Re: How to add SQL fields to slide show?
Post by: mstralka on August 25, 2004, 02:07:53 am
I'm not sure if this will work perfectly with 1.2, but it works with 1.3.1.
This will display the filename of each picture during slideshow.  See my comment below to display a different field(s)

displayimage.php
FIND: (in slideshow function)
Code: [Select]
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',
ADD:
Code: [Select]
'{SLIDESHOW_CAPTION}' => '<textarea id="slideshow_caption" class="textinput" cols="60" disabled="true"></textarea>',

themes/yourtheme/theme.php
FIND:
Code: [Select]
$template_display_picture = <<<EOT
        <tr>
                <td align="center" class="tableb" height="{CELL_HEIGHT}" style="white-space: nowrap; padding: 0px;">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
                                        <td>
                                                {IMAGE}
                                                {ADMIN_MENU}
ADD:
Code: [Select]
{SLIDESHOW_CAPTION}

include/slideshow.inc.php
FIND:
Code: [Select]
var Pic = new Array() // don't touch this
ADD:
Code: [Select]
var Pic_Caption = new Array()

FIND:
Code: [Select]
        echo "Pic[$i] = '" . $picture_url . "'\n";
ADD:
Change $picture['filename'] to $picture['caption'] if you want to see the caption instead.
This can also be modified to display multiple SQL fields.

Code: [Select]
echo "Pic_Caption[$i] = '". $picture['filename'] . "'\n";

FIND:
Code: [Select]
        document.images.SlideShow.src = preLoad[j].src
ADD:
Code: [Select]
document.getElementById("slideshow_caption").value = Pic_Caption[j]


I was able to make this work with a textarea box, but I couldn't get it to write the image's caption to a <DIV>.
If anyone can figure out why
Code: [Select]
//in displayimage.php
'{SLIDESHOW_CAPTION}' => '<div id="slideshow_caption"></div>',
and:
Code: [Select]
//in includes/slideshow.inc.php
document.getElementById("slideshow_caption").innerHtml = Pic_Caption[j]
doesn't work?
Title: Re: How to add SQL fields to slide show?
Post by: apexweb on September 11, 2004, 09:58:24 pm
Thanks for the response.

Followed your instructions to the letter, but in CM 1.2, and it broke my slide shows.  So, I upgraded to 1.3.2, and redid the above changes, with the same result.  :-\\  :\'(

See http://www.naturalwaterslide.com/photos/displayimage.php?album=9&slideshow=5000

Could it have to do with my custom theme?  Nope.  Tried switching to default, and the slide show is still brokenDomain name is still unawarded, but if two people both contribute pretty much the same degree, then I'll give out two.
Title: Re: How to add SQL fields to slide show?
Post by: apexweb on September 15, 2004, 11:38:08 pm
I'd like to correct something stated earlier, and that's the cause of the slideshow breaking -- it was not due to MStralka's solution, but rather due to apostrophe's and &quot; in the database.  Now compensating MStralka, along with my thanks.
Title: Re: How to add SQL fields to slide show?
Post by: willstein on October 27, 2005, 04:01:21 am
The slideshow works great, but I'm getting  {SLIDESHOW_CAPTION} whenever an intermiddiate image is displayed - any idea why?

Also, anyway to change from filename, to title, and description?
Would I need to mend this:
Code: [Select]
echo "Pic_Caption[$i] = '". $picture['filename'] . "'\n";
Title: Re: How to add SQL fields to slide show?
Post by: Joachim Müller on October 27, 2005, 08:19:46 am
post on a board that deals with your version of coppermine, this sub-board is for the outdated, unsupported version cpg1.2.x that is only there for reference.