I have been able to get cpmFetch to work beautifully showing random images and date (views and ranks) on php pages across my site and even in my bridged phpbb. Problem is that I can not get this to show on my CPM template page because that is HTML.
anyone know how to get something like the following code/formatting to work in CPM templates (it works in php pages):
<?php include($DOCUMENT_ROOT . "/gallery/cpmfetch/cpmfetch.php");
$styleguide = array(
"imagewidth" => '100',
"imageStyle" => "cpm_brdr",
"subtitle" => "<span class='fnt_9'>%h views<br />%v votes</span>",
"alttag" => "Click to see more photos in gallery");
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1,$styleguide);
?>
Thanks for feedback /direction.
PS Please do not move this topic to the cpmFetch board on coppermine becuase vuud recommended I try and get help here.
Use the custom header/footer feature.
ahh very clever, but I've spent hours trying to set it up and can't get it.
Can I get a little more direction please. Here are the parts:
my cpm is located at: mysite/gallery
I've confirmed my template has {CUSTOM_HEADER} and {CUSTOM_FOOTER}
cpmFetch is working on php files throughout my site with the following code:
in body:
<?php include($DOCUMENT_ROOT . "/gallery/cpmfetch/cpmfetch.php");
$styleguide = array(
"imagewidth" => '100',
"imageStyle" => "cpm_brdr",
"subtitle" => "<span class='fnt_9'>%h views<br />%v rating</span>",
"alttag" => "Click to see more StarPhotos in the SuperStar Gallery!");
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1,$styleguide);
?>
in page footer:
<?php $objCpm->close(); ?>
Thanks for the help.
Save that code into a php file, upload it to your coppermine directory, enter the path to it in config. If you need it above/before the {GALLERY} tag then it's a custom header. Otherwise it's a custom footer.
It seems so straight foward but I cant get it working:
in the config footer I put:
/gallery/includes/cpm_link.php
uploaded the following to that location as cpm_link.php
<?php
include($DOCUMENT_ROOT . "/gallery/cpmfetch/cpmfetch.php");
$styleguide = array(
"imagewidth" => '100',
"imageStyle" => "cpm_brdr",
"subtitle" => "<span class='fnt_9'>%h views<br />%v ranks</span>",
"alttag" => "Click to see more StarPhotos in the SuperStar Gallery!");
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1,$styleguide);
$objCpm->close();
?>
and I do have the {CUSTOM_FOOTER} tag in my template.
Can you tell me what the problem is - so for the hand holding.
It needs to be a relative path, not an absolute path. If you upload it into your Coppermine directory then the path would just be cpm_link.php.
Nibbler - GOT IT ! Thanks for your help and not dropping the support with each additional request - couldn't have done it without you (because I've been working on this off and on for a year).
Now 'to give a little back'.
For others, here you go (make your unique changes)
Assumes that CPG is located at:
yoursite/gallery
and that cpmFetch is located at:
yoursite/gallery/cpmFetch
in CPG open config and put in
include/cpm_link.php
(this references the following new .php file in CPG/include folder)
create new file with the following code and name it cpm_link.php
<?php
include "./cpmfetch/cpmfetch.php";
$styleguide = array(
"subtitle" => "<span class='fnt_9'>%h views<br />%v votes</span>",
"alttag" => "Click to this picture in the Gallery !");
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewRandomMedia(1,1,$styleguide);
$objCpm->cpm_close();
?>
put the new file in yoursite/gallery/include
put {CUSTOM_FOOTER} anywhere after {GALLERY} in your template
random media will show from all public albums.
enjoy the true integration!