Embed CPMFetch into Coppermine Template? Embed CPMFetch into Coppermine Template?
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Embed CPMFetch into Coppermine Template?

Started by scandore8472, December 28, 2007, 02:59:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scandore8472

I hope this is the right forum. Is there a way to do this? I've been searching for a while and can't seem to find a solution.

I'm trying to create a random picture module using CPMFetch to display on the intermediate picture page. The code works outside of coppermine, but as soon as I try putting it into the theme.php file, it fails. I have to admit, I am a PHP noob so I may be trying to integrate the code incorrectly. I'm just copy and pasting it into the theme file.

I'm using CPMFetch 2.0 and coppermine 1.4.13

scandore8472

Nevermind, I figured it out. I modified the instructions for inserting the code into phpbb template.

Here is the code for future reference.

Copy the function theme_html_picture() from the sample theme file to your theme.php



Once you have the function copied over, find


$params = array('{CELL_HEIGHT}' => '100',




Add Before


include_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setReturnType('html');


Then find

'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),

Add After:

'{FETCHRANDOM}' => $objCpm->cpm_viewRandomMedia(2, 3),

Then find

);

This should be directly below the code you just added, if not it is the end of the array

After Add

$objCpm->cpm_close();


To add it to the intermediate picture copy the template for intermediate image display from the sample template to your theme.php

Then use {FETCHRANDOM} to position the cpmfetch module on the page