TinyPortal
Development => Support => Topic started by: scott_t on June 21, 2009, 10:59:16 PM
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
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");
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", 1, 6, $options);
$objCpm->cpm_close();
?>
Additional question. In the code of the block, do I need to include the <?php tag?
<?php or ?> tags cannot be used in a block.
All set, works like a charm...Thanks...
ST