How to add SQL fields to slide show? How to add SQL fields to slide show?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

How to add SQL fields to slide show?

Started by apexweb, August 23, 2004, 09:51:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

apexweb

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,
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

Joachim Müller

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

apexweb

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.)
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

mstralka

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)

    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',

ADD:

'{SLIDESHOW_CAPTION}' => '<textarea id="slideshow_caption" class="textinput" cols="60" disabled="true"></textarea>',


themes/yourtheme/theme.php
FIND:

$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:

{SLIDESHOW_CAPTION}


include/slideshow.inc.php
FIND:

var Pic = new Array() // don't touch this

ADD:

var Pic_Caption = new Array()


FIND:

        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.


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


FIND:

        document.images.SlideShow.src = preLoad[j].src

ADD:

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

//in displayimage.php
'{SLIDESHOW_CAPTION}' => '<div id="slideshow_caption"></div>',

and:

//in includes/slideshow.inc.php
document.getElementById("slideshow_caption").innerHtml = Pic_Caption[j]

doesn't work?
GO IRISH

apexweb

#4
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.
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

apexweb

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.
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

willstein

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:
echo "Pic_Caption[$i] = '". $picture['filename'] . "'\n";

Joachim Müller

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.