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: CPMFetch in a WordPress blog ...  (Read 8737 times)

0 Members and 1 Guest are viewing this topic.

florennes-as.be

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
CPMFetch in a WordPress blog ...
« on: April 19, 2009, 05:19:33 pm »

Hello all !

I want to do a blog reporting my photo works, easily and nicely with lot's of pictures from Coppermine galleries in messages.
I discovered WordPress (great !) and gave a try to CpmFetch (which i used in trhe past for webpages, here i installed v2.0.0).

Sooo, i want to add a script like this in a message (this shows image 973 reduced by 640px wide, with link to the album; myhost_root is of course to modify regarding your provider) ;
    include "/myhost_root/airpassi/www/photos/cpmfetch/cpmfetch.php";
    $objCpm = new cpm("/myhost_root/airpassi/www/photos/cpmfetch/cpmfetch_config.php");
    $options = array('windowtarget' => '_blank',"imagesize"=>"large","imagewidth"=>"650","imagelink"=>"album","subtitle" => "<center> {{pHits}} Views</center>");
    $objCpm->cpm_viewMediaByPid (973, $options);
    $objCpm->cpm_close();

First problem, WordPress does not understand php.  :'(
This was easily solved in installing exec-php to WordPress !   :-*

Then, a try with the above script ... This works fine !  :o
... but if i add a second message with the same (kind of) script, the second 'include' included in the second script is giving an error.  :'(

So, i need only one call to the include, before messages (with cpm calls) are shown.
I put the include line at the end of the header.php file, and removed the include line call from message's scripts. A try was successful ! GREAT !  :D

So i now have plenty of ideas and CPMFetch will help me to solve them ! This is a really great extension !!!  ;D

To summarize ;

1st ; add the include reference in the header.php
2nd; create a message to see a reduced size picture (picture 973, 600px wide, with link to the album, and hits)
    $objCpm = new cpm("/myhost_root/airpassi/www/photos/cpmfetch/cpmfetch_config.php");
    $options = array('windowtarget' => '_blank',"imagesize"=>"large","imagewidth"=>"650","imagelink"=>"album","subtitle" => "<center> {{pHits}} Views</center>");
    $objCpm->cpm_viewMediaByPid (973, $options);
    $objCpm->cpm_close();
3rd; second message showing three defined thumbs (from image 973, 974, 975) in a small table (side by side) ; so a mix of html (for the table structure) and cpm calls is needed.
<table width="100%" border="0">
  <tr>
    <td>
   <?
    $objCpm = new cpm("/myhost_root/airpassi/www/photos/cpmfetch/cpmfetch_config.php");
    $objCpm->cpm_viewMediaByPid  (973);
    ?>
   </td>
    <td>
   <?
    $objCpm->cpm_viewMediaByPid  (974);
    ?>   
   </td>
    <td>
    <?
    $objCpm->cpm_viewMediaByPid  (975);
    ?>
   </td>
  </tr>
</table>
4th; need to see the 6 last added pictures ?
<?php
  $objCpm = new cpm("/myhost_root/airpassi/www/photos/cpmfetch/cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(2,3);
  $objCpm->cpm_close();
?>

And so on ...

I have to say understanding cpmfetch was not easy at the beginning (i am not a great coder) but it is really worth the effort !!!  ;)
For new users, read the manuals, try, try again ... this extension is AWESOME !!!

MANY thanks to the coders !!!  ;)

L@urent
Logged

tinorebel

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 87
  • live long and prosper!
    • www.tripodart.net
Re: CPMFetch in a WordPress blog ...
« Reply #1 on: April 24, 2009, 06:23:19 pm »

hallo
I just tried to apply there instructions, installed php-exe plugin in mw wordpress, then

insert this code in the heading:

Code: [Select]
<tr>
          <?php
    
include "http://www.tripodart.net/website/gal/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("http://www.tripodart.net/website/gal/cpmfetch/cpmfetch_config.php");
  
$options = array( "tablestyle" => "cssfortables" imageheight => "50",  alttag => "%t ALBUM: %a , %w, %d");
  
$objCpm->cpm_viewRandomMedia(10,1$options);
    
$objCpm->cpm_close();

?>

</tr>

(I'd like to have a random 10 images in the heading)

But I get an error:


Fatal error: Class 'cpm' not found in /home/tinorebe/public_html/blog/wp-content/themes/black-letterhead-10/header.php on line 21

I cant understand why, can someone help me?

Thnks ::)
Logged
Live long and prosper!
www.tripodart.net

mrshs

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: CPMFetch in a WordPress blog ...
« Reply #2 on: October 24, 2009, 09:15:03 pm »

HI!

I am facing the same problem.

Only my error message varies a bit:

Fatal error: Class 'cpm' not found in /home1/silveru1/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 3


I used this code to embedd it into some blog post.

<?php
        include "./galleries/cpmfetch/cpmfetch.php";
        $objCpm = new cpm("./galleries");
        $objCpm->cpm_viewRandomMedia(3,1);
        $objCpm->cpm_close();
?>

I also have some php-executer installed, and with simple php code it works, but not cpmfetch. Being still a newbie to all this, I, of course, have troubles with finding the problem. I hope you can help.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: CPMFetch in a WordPress blog ...
« Reply #3 on: October 25, 2009, 10:17:00 pm »

I am facing the same problem.

Only my error message varies a bit:


So it is not the same problem is it :P

Please, always start your own thread as per the board rules.

http://forum.coppermine-gallery.net/index.php/topic,55415.0.html
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.