Advanced search  

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]

Pages: [1]   Go Down

Author Topic: How to add SQL fields to slide show?  (Read 10577 times)

0 Members and 1 Guest are viewing this topic.

apexweb

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
    • http://apexwebsolutions.com
How to add SQL fields to slide show?
« 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,
Logged
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to add SQL fields to slide show?
« Reply #1 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
Logged

apexweb

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
    • http://apexwebsolutions.com
Re: How to add SQL fields to slide show?
« Reply #2 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.)
Logged
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

mstralka

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 178
Re: How to add SQL fields to slide show?
« Reply #3 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?
Logged
GO IRISH

apexweb

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
    • http://apexwebsolutions.com
Re: How to add SQL fields to slide show?
« Reply #4 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.
« Last Edit: September 15, 2004, 11:39:19 pm by apexweb »
Logged
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

apexweb

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
    • http://apexwebsolutions.com
Re: How to add SQL fields to slide show?
« Reply #5 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.
Logged
Stephen Walker
Apex Web Solutions offers web hosting with Coppermine installation script

willstein

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 120
    • mansei
Re: How to add SQL fields to slide show?
« Reply #6 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";
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to add SQL fields to slide show?
« Reply #7 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 18 queries.