Advanced search  

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

Pages: [1]   Go Down

Author Topic: Separate latest and random pics...  (Read 4185 times)

0 Members and 1 Guest are viewing this topic.

adnoctum

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Separate latest and random pics...
« on: November 02, 2006, 05:07:49 pm »

First of all, great stuff !

I got it to work on a site, I used this code...

Code: [Select]
<?php
include "galleri/cpmfetch/cpmfetch.php";
$objCpm = new cpm('/galleri');
$objCpm->cpm_viewLastAddedMedia (2,1,array("imagestyle" => "test1"));
$objCpm->cpm_viewRandomMedia (2,1,array("imagestyle" => "test1"));
$objCpm->cpm_close();
?>


But, I would like to separate "latest added" and "random" from each other, and have random at one place on my mainpage and latest at a different place.I did try to make two php include files out of it, one for latest and one for random.

I get the following error message: "Fatal error: Cannot redeclare class cpm in "LINK TO CPMFETCH.PHP" on line 33.

How can I get it to work ?
« Last Edit: November 03, 2006, 08:03:10 pm by vuud »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Separate latest and random pics...
« Reply #1 on: November 02, 2006, 05:15:58 pm »


Easy.  You just "reuse" your $objCpm...

Here is how...

Code: [Select]
<-- This is at the top of your file -->
<?php
include "galleri/cpmfetch/cpmfetch.php";
$objCpm = new cpm('/galleri');
?>


... html, other stuff goes here - whatever

<?php
$objCpm
->cpm_viewLastAddedMedia (2,1,array("imagestyle" => "test1"));
?>


... more html, whatever...

<?php
$objCpm
->cpm_viewRandomMedia (2,1,array("imagestyle" => "test1"));
?>


... more html, whatever...

<!-- this is the bottom of your file -->
<?php
$objCpm
->cpm_close();
?>


You do that as many times as you want, just have one "new" and one "close".
Logged
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
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 15 queries.