TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 451
  • Total: 451

2 blocks with cpmfetch?

Started by Scott_T, June 21, 2009, 10:59:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scott_t

Thanks to ZarPrime, I now have my coppermine block working via cpmfetch. My only additional question is if it is possible to have 2 cpmfetch blocks? What I'd like to do is have the one existing gallery with random images which works, then a second block with images from another gallery under that block.

The problem I have is with the exact same code that is working in block #1

include "../SCTNBLTCOPPER/cpmfetch/cpmfetch.php";
 $objCpm = new cpm("../SCTNBLTCOPPER/cpmfetch/cpmfetch_config.php");
 $objCpm->cpm_viewRandomMedia(1,6);
 $objCpm->cpm_close();


Gives me an error in block # 2:
Fatal error: Cannot redeclare class cpm in /homepages/9/d139621264/htdocs/SCTNBLTCOPPER/cpmfetch/cpmfetch.php on line 50

So really I have 2 questions here..

1. Can cpmfetch handle more then 1 block?
2. Can I direct cpmfetch to a specific album, not the general public album #1?

Thanks,

Scott

IchBin

Since you are calling the code twice, you should instead use require_once() instead of include().

Try changing this line:
include "../SCTNBLTCOPPER/cpmfetch/cpmfetch.php";

To this:
require_once("../SCTNBLTCOPPER/cpmfetch/cpmfetch.php");

scott_t

Worked like a charm Ichbin. Appreciated. Now all I need to do is test code for using a specific album, not all public albums. So I will have 2 cpmfetch blocks.

1. One showing random public gallery images from coppermine
2. Another showing public images from a different album and only that album.

For item # 2 this is the code I am planning on trying...

<?php
require_once "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setfilter($filter ".jpg");
$options = array('windowtarget' => '_top',"imagewidth"=>"130","subtitle" => "<center></center>","tablestyle" => "cpmfetch");
$objCpm->cpm_viewRandomMediaFrom ("album=4"16$options);
$objCpm->cpm_close();
?>


Additional question. In the code of the block, do I need to include the <?php tag?

IchBin

<?php or ?> tags cannot be used in a block.

scott_t

All set, works like a charm...Thanks...

ST

This website is proudly hosted on Crocweb Cloud Website Hosting.