Using cpmFetch on one page calling two galleries? Using cpmFetch on one page calling two galleries?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Using cpmFetch on one page calling two galleries?

Started by iamfez, January 31, 2007, 11:53:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

iamfez

I'm having a problem trying to get cpmFetch to call images from two galleries on the one page. I've got 1.9.8 successfully installed on both galleries but on the test page I'm using which replicas my main page I can't call images from the second gallery.

My page is in tables and in the first table I've successfully called images. This is the code I used:

Quote<?php
include "./regular/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 10,array("windowtarget" => "_new"));
?>
</div></td>
    <td><div align="center"><?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 15,16,array("windowtarget" => "_new"));
?></div></td>
    <td><div align="center"><?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 21,22,array("windowtarget" => "_new"));
?>

I used the exact same code on the second table except I changed the gallery name to the correct one and I get this error:

QuoteFatal error: Cannot redeclare class cpm_dao in /pathto/mygallery/framebyframe/cpmfetch/cpmfetch_dao.php on line 22

I'm not sure how to fix it. I've been looking through other threads and I found something like my problem but it was for 1.6.5 and didn't work when I tried it.

Would it be possible for me to have three different tables on the one page that use two galleries? Because I'm hoping to have:

Table 1 - Images from first gallery
Table 2 - Images from second gallery
Table 3 - Images from first gallery again

iamfez

Okay tried renaming the cpm but still no luck.

This is the code I'm trying:

Quote<?php
include "./framebyframe/cpmfetch/cpmfetch.php";
$objCpm2 = new cpm("./framebyframe/cpmfetch/cpmfetch_config.php");
$objCpm2->cpm_viewLastAddedMediaFromCategory (1,1, 13,array("windowtarget" => "_new"));
?>

vuud

Quote from: iamfez on February 01, 2007, 05:46:10 PM
Okay tried renaming the cpm but still no luck.

This is the code I'm trying:



With this code, what is the error you get?  What happens?
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez

I get this:

QuoteFatal error: Cannot redeclare class cpm_dao in /path/to/domain/framebyframe/cpmfetch/cpmfetch_dao.php on line 22

This is the test page I'm using:

http://www.harryandginny.org/test2a.php

And, this is how I'm trying to get it to look where I can call images just fine from the first gallery but I've left out the code for the second so the bottom table shows up, just to give you a rough idea of what I'm trying to do.

http://www.harryandginny.org/test2.php

vuud

Quote from: iamfez on February 02, 2007, 11:08:54 AM
I get this:

This is the test page I'm using:

http://www.harryandginny.org/test2a.php

And, this is how I'm trying to get it to look where I can call images just fine from the first gallery but I've left out the code for the second so the bottom table shows up, just to give you a rough idea of what I'm trying to do.

http://www.harryandginny.org/test2.php

Are you trying to do different Galleries OR different categories or albums?

Gallery as in Coppermine Photo "Gallery"?

If you are pulling them all out of the same Gallery, then you don't need a new one at all:


include "./regular/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 10,array("windowtarget" => "_new"));
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1,15,16,array("windowtarget" => "_new"));
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 21,22,array("windowtarget" => "_new"));

I noticed you created some new function calls with the last two.  I hope you added the code into cpmfetch correctly :)

All kidding aside, the last two will not work, or if they do, its pure luck.  If you want to combine categories in one call it would be more like:

$objCpm->cpm_viewLastAddedMediaFrom("cat=15,16",1,1,array("windowtarget" => "_new"));
$objCpm->cpm_viewLastAddedMediaFrom("cat=21,22",1,1,array("windowtarget" => "_new"));










Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez

It's two different Coppermine galleries that I have installed. One is called Regular and the other is Frame-by-Frame. I've created three tables on my test page that is a mock of my index that I want to use cpmfetch on.

First Table - calling images from "Regular" gallery:
Quote<table width="100%" border="#000000" bordercolor="#000000" border-style="solid" border-top-width="0" border-right-width="0" border-bottom-width="0"
border-left-width="0">
  <tr>
    <td bgcolor="#88938B"><div align="center"><strong>HARRY/GINNY</strong></div></td>
    <td bgcolor="#88938B"><div align="center"><strong>HARRY</strong></div></td>
    <td bgcolor="#88938B"><div align="center"><strong>GINNY</strong></div></td>
  </tr>
  <tr>
    <td><div align="center">
   <?php
include "./regular/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 10,array("windowtarget" => "_new"));
?>
</div></td>
    <td><div align="center"><?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 15,16,array("windowtarget" => "_new"));
?></div></td>
    <td><div align="center"><?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 21,22,array("windowtarget" => "_new"));
?></div></td>
  </tr>
</table>

The first table works perfectly.

Second Table - calling images from "Frame-by-Frame" gallery:
Quote<table width="100%" border="#000000" bordercolor="#000000" border-style="solid" border-top-width="0" border-right-width="0" border-bottom-width="0"
border-left-width="0">
  <tr>
    <td bgcolor="#88938B"><div align="center"><strong>HARRY/GINNY</strong></div></td>
    <td bgcolor="#88938B"><div align="center"><strong>HARRY</strong></div></td>
    <td bgcolor="#88938B"><div align="center"><strong>GINNY</strong></div></td>
  </tr>
  <tr>
    <td><div align="center">
                    <?php
include "./framebyframe/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./framebyframe/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 13,array("windowtarget" => "_new"));
?>
                  </div></td>
    <td><div align="center">
                    <?php
$objCpm = new cpm("./framebyframe/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 18,19,array("windowtarget" => "_new"));
?>
                  </div></td>
    <td><div align="center">
                    <?php
$objCpm = new cpm("./framebyframe/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMediaFromCategory (1,1, 23,24,array("windowtarget" => "_new"));
?>
                  </div></td>
  </tr>
</table>

This table doesn't work at all. Instead I get the following error:

QuoteFatal error: Cannot redeclare class cpm_dao in /path/tomygallery/framebyframe/cpmfetch/cpmfetch_dao.php on line 22

It also stops table three from showing up which is:

Third Table:
Quote<table width="100%" border="#000000" bordercolor="#000000" border-style="solid" border-top-width="0" border-right-width="0" border-bottom-width="0"
border-left-width="0">
                    <tr>
                      <td bgcolor="#88938B"><div align="center"><strong>HARRY/GINNY</strong></div></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                          <?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFromCategory (1,3, 10,array("windowtarget" => "_new"));
?>
                        </div>
                        <div align="center"></div>
                        <div align="center"></div></td>
                    </tr>
                    <tr>
                      <td bgcolor="#88938B"><div align="center"><strong>HARRY POTTER</strong></div></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                          <?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFromCategory (1,3, 15,16,array("windowtarget" => "_new"));
?>
                        </div></td>
                    </tr>
                    <tr>
                      <td bgcolor="#88938B"><div align="center"><strong>GINNY WEASLEY</strong></div></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                          <?php
$objCpm = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFromCategory (1,3, 21,22,array("windowtarget" => "_new"));
?>
                        </div></td>
                    </tr>
                  </table>

When I deleted table two this worked fine. So the problem seems to be when I call images from the second gallery. Both galleries have 1.9.8 installed on them and the install file works. At the moment I'm still using 1.6.5 on my main page and using iframes to call the images from - and I can call images from the Frame-by-Frame gallery fine.

So I guess the real problem for me is calling images from two different galleries (not categories) on the one page.

vuud

Quote from: iamfez on February 03, 2007, 08:15:01 PM

So I guess the real problem for me is calling images from two different galleries (not categories) on the one page.

You have two problems as I can see...

First, you are using $objCpm over and over again.  Try chaning the name for each different gallery...
$cpmRegular =
$cpmFrameByFrame =

Well, i think table three is $cpmRegular again, so don't do anything for that one... just call the
$cpmRegular->cpm_viewRandomMediaFromCategory (1,3....

Its already degfined and all... just don't call a close at the top.

Second You are trying to redeclare, cpm_dao each time you do the include.  Just have one include at the top of the file.  The new statement will differentiaite it.  Its the second include that is generating the error


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez

I don't understand why when I add the second include it's a fault since there's two cpm_dao files in two completely different folders. I had to use two because I had to have the correct path to each gallery in the cpm_dao files 'cause remember I had a problem before just trying to call images from certain categories?

Okay I took away the second include that's from the frame-by-frame gallery and I get this:

QuoteFatal error: Cannot redeclare getuseroverrides() (previously declared in /path/tomygallery/regular/cpmfetch/cpmfetch_config.php:7) in /path/tomygallery/framebyframe/cpmfetch/cpmfetch_config.php on line 6

It's trying to use the cpmfetch_config file from the wrong gallery.

vuud

Quote from: iamfez on February 04, 2007, 07:14:44 PM
I don't understand why when I add the second include it's a fault since there's two cpm_dao files in two completely different folders. I had to use two because I had to have the correct path to each gallery in the cpm_dao files 'cause remember I had a problem before just trying to call images from certain categories?

Basically because cpmFetch is an object oriented program (at least as much as php allows).  So inside that file (or both of them) a particular object is defined (cpm_dao).  When you try to define it twice you get the same error.

Think of it this way... In real life you have an object named "pencil".  This is just a pencil.  Now, lets say you have a car, but instead of calling it a "car" you also call this a "pencil".  Now, throw in a really enthusiastic person who is not very smart, but does exactly what he's told (like a computer) "Hey, go get me a pencil...".  He may return the real pencil or a car.  You will never know which...  A computer is a lot like that, so what happens is that there are rules that prevent you from naming things twice the same way.

And that is my 30 sec lesson on objects. (I love objects).

Anyway...


Quote
Okay I took away the second include that's from the frame-by-frame gallery and I get this:

Cannot redeclare getuseroverrides() (previously declared in /path/tomygallery/regular/cpmfetch/cpmfetch_config.php:7) in /path/tomygallery/framebyframe/cpmfetch/cpmfetch_config.php on line 6

It's trying to use the cpmfetch_config file from the wrong gallery.

Oww.  Now that could be a bit peskier.  Can you repost the exact code we are working with here.  I know we have a few copies below (or above), but I'd like to get back on the same copy

Thx

Vuud

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez

Oh, I get it now about objects! Thanks!

Okay here's the code. At the top of the page now I'm using:

Quote<?php
include "./regular/cpmfetch/cpmfetch.php";
?>

On the first table that calls on images from the Regular gallery:
Quote<td><div align="center">
   <?php
$cpmRegular = new cpm("./regular/cpmfetch/cpmfetch_config.php");
$cpmRegular->cpm_viewLastAddedMediaFromCategory (1,1, 10,array("windowtarget" => "_new"));
?>
</div></td>
    <td><div align="center"><?php
$cpmRegular->cpm_viewLastAddedMediaFromCategory (1,1, 15,16,array("windowtarget" => "_new"));
?></div></td>
    <td><div align="center"><?php
$cpmRegular->cpm_viewLastAddedMediaFromCategory (1,1, 21,22,array("windowtarget" => "_new"));
?></div></td>

Second table that calls images from the Frame-by-Frame gallery:
Quote<td><div align="center">
                    <?php
               $cpmFrameByFrame = new cpm("./framebyframe/cpmfetch/cpmfetch_config.php");
$cpmFrameByFrame->cpm_viewLastAddedMediaFromCategory (1,1, 13,array("windowtarget" => "_new"));
?>
                  </div></td>
    <td><div align="center">
                    <?php
$cpmFrameByFrame->cpm_viewLastAddedMediaFromCategory (1,1, 18,19,array("windowtarget" => "_new"));
?>
                  </div></td>
    <td><div align="center">
                    <?php
$cpmFrameByFrame->cpm_viewLastAddedMediaFromCategory (1,1, 23,24,array("windowtarget" => "_new"));
?>
                  </div></td>

And the third table that calls from the Regular gallery again:
Quote<td><div align="center">
                          <?php
$cpmRegular->cpm_viewRandomMediaFromCategory (1,3, 10,array("windowtarget" => "_new"));
?>
                        </div>
                        <div align="center"></div>
                        <div align="center"></div></td>
                    </tr>
                    <tr>
                      <td bgcolor="#88938B"><div align="center"><strong>HARRY POTTER</strong></div></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                          <?php
$objCpmRegular->cpm_viewRandomMediaFromCategory (1,3, 15,16,array("windowtarget" => "_new"));
?>
                        </div></td>
                    </tr>
                    <tr>
                      <td bgcolor="#88938B"><div align="center"><strong>GINNY WEASLEY</strong></div></td>
                    </tr>
                    <tr>
                      <td><div align="center">
                          <?php
$objCpmRegular->cpm_viewRandomMediaFromCategory (1,3, 21,22,array("windowtarget" => "_new"));
?>
                        </div></td>

vuud

Quote from: iamfez on February 05, 2007, 10:50:01 AM
Oh, I get it now about objects! Thanks!

Okay here's the code. At the top of the page now I'm using:

On the first table that calls on images from the Regular gallery:
Second table that calls images from the Frame-by-Frame gallery:
And the third table that calls from the Regular gallery again:

I am thinking this is a bug in my development code. 

1) Thanks for finding it

2) I will have to poke it some.

bbl
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez


vuud

Quote from: iamfez on February 05, 2007, 10:19:00 PM
Okay :) Thanks for doing this!

This fix required a very large rewrite of the whole install and config file...

In testing now, be posted tomorrow night.  Version 1.9.9
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

iamfez


vuud

Quote from: iamfez on February 17, 2007, 01:21:50 PM
Can't wait to download it! :D


Iamfez has confirmed that dev release 1.9.9 has fixed his problem.

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco