Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: CPMFETCH CODE for Wordpress  (Read 18605 times)

0 Members and 1 Guest are viewing this topic.

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
CPMFETCH CODE for Wordpress
« on: September 09, 2006, 11:45:51 am »

Hi,

I would like some help.

I've installed this great tool and it works fine when i test some example on my Wordpress page.

Can somebody help me with code to display what i need as follow because it seems that i don't understand how to use the functions and array because i'm familiar with coding.

1. I want to display 5 random file from my coppermine gallery
- All files get displayed in one row and same size
- Also, the files name are displayed below the file

2. I want to display recent uploaded files to my wordpress page with same requirement as above

I've tried some function like cpm_viewRandomMedia ( $rows, $columns, [array $options = ""]) but donno where tu put stuffs. When i changed the variable keep on getting error. Frustrated.
« Last Edit: September 14, 2006, 04:20:34 am by vuud »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Re: Just a random image in wordpress sidebar
« Reply #1 on: September 09, 2006, 05:58:32 pm »

I split your post from the original thread because your question, though pertaining to wordpress, differs from the thread-starter's needs.
Logged

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
CPMFETCH CODE for Wordpress
« Reply #2 on: September 09, 2006, 09:46:17 pm »

From TranDanze:
   <li>
      <h2><?php _e('Random photo'); ?></h2>
         <div align="center">
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $options = array( 'subtitle' => '%t');
         $objCpm->cpm_viewRandomMedia(1,1, $options);
         $objCpm->cpm_close();
         ?>
         </div>
   </li>

Great, this work fine not just in your sidebar, but in my wordpress page.

Question:

1. How to make all pictures and data images get displayed on the same size, i look to the example about CSS in the developer page, where to put the CSS, it is in my wordpress theme CSS?
2. If i would like to display 10 recently uploaded files, linked file name, how to do it. I found CFRSSGET but no further example on how to use it.
3. I've tried this code, but nothing appear?Anything wrong?
<?php
/*
Template Name: Test
*/
?>


<?php get_header();?>   

   <li>
      <h2><?php _e('Random photo'); ?></h2>
         <div align="center">
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $options = array( 'subtitle' => '%t' , 'imagewidth' => '70',         'imageheight' => '55', 'tablestyle' => "cssfortables" );
         $objCpm->cpm_viewLastAddedMediaFrom(1, 5, "cat=1:album=3", $options);

         $objCpm->cpm_close();
         ?>
         </div>
   </li>

<?php get_footer();?>

4. How to use cpmfetch functions in one page at different places?Because when i use the function say at the top of the page, and use it again at below of the page, it would say
Fatal error: Cannot redeclare class cpm in /home/dakwah/public_html/cpmfetch/cpmfetch.php on line 33

Example:
- cpfetch code for displaying last upload
         <div align="center">
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $options = array( 'subtitle' => '%t');
         $objCpm->cpm_viewLastAddedMedia(1, 7, $options);
         $objCpm->cpm_close();
         ?>
         </div>
- some wording
- cpmfetch code for displaying random files
         <div align="center">
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $options = array( 'subtitle' => '%t');
                        $objCpm->cpm_viewRandomMedia(1,1,$options);
         $objCpm->cpm_close();
         ?>
         </div>

5. Why image for pdf data not displaying? The code not displaying the image, but linked file name
« Last Edit: September 10, 2006, 12:03:56 am by dakwah »
Logged

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
[Nearly Solved] CPMFETCH CODE for Wordpress
« Reply #3 on: September 10, 2006, 05:06:01 pm »

      <?php include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         ?>
         <table width="431" id="table1" height="104">
             <tr>
             <td style='width:429;padding:.75pt' bgcolor="#DEEDFA" height="45">
             <p><u><b><font face="Arial" size="2">Koleksi Terbaru:</font></b></u></p>
               <?php
               $options = array( 'subtitle' =>'%t' , 'imagewidth' => '70',         'imageheight' => '55', 'tablestyle' => "cssfortables" );
               $objCpm->cpm_viewLastAddedMedia(1, 5, $options);  ?>
            </td></tr>
                        
             <tr>
              <td style='width:429;padding:.75pt' bgcolor="#DEEDFA" height="49">
              <p><u><b><font face="Arial" size="2">Random Koleksi:</font></b></u></p>
                 <?php
               $options = array( 'subtitle' =>'%t' , 'imagewidth' => '70',         'imageheight' => '55', 'tablestyle' => "cssfortables" );
               $objCpm->cpm_viewRandomMedia(1, 5,$options);  ?>
            </td></tr>
         </table>
      <?php $objCpm->cpm_close(); ?>

This use table...
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #4 on: September 10, 2006, 05:10:51 pm »

Question:
1. How to make all pictures and data images get displayed on the same size, i look to the example about CSS in the developer page, where to put the CSS, it is in my wordpress theme CSS?

Set the imagewidth to something so they all get resized.  You could set both width and height, but it will distort pictures.


Quote
2. If i would like to display 10 recently uploaded files, linked file name, how to do it. I found CFRSSGET but no further example on how to use it.

Use the lastAddedMedia calls I think...


Quote
4. How to use cpmfetch functions in one page at different places?Because when i use the function say at the top of the page, and use it again at below of the page, it would say
Fatal error: Cannot redeclare class cpm in /home/dakwah/public_html/cpmfetch/cpmfetch.php on line 33

Do the "new" and "close" only once on a page.  New at the top, close at the bottom (or not at all)


Quote
5. Why image for pdf data not displaying? The code not displaying the image, but linked file name

Sunspots?  Does CPG have a pdf image in it?  Probably, but I have never looked for it.
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #5 on: September 10, 2006, 05:14:40 pm »

Yes CPG does have PDG image. Is that why i pdf thumbnails not displaying? I really need it. How to get it work?Any extra coding?
Logged

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #6 on: September 11, 2006, 09:32:09 am »

Hi, i still can't get hot to display list of last added images [linked] in one column. Please help.

Example:
03/13/06   Misc - Just don't fit anywhere
01/11/06   Our furry friends
07/01/05   June 2005 - Becket Trip 0x02
06/05/05   Panthorn Park trails day 2005
12/07/04   Aug 2004 - My birthday at Session Woods
12/07/04   May 2003 - Becket Trip

But each items are linked to their post
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #7 on: September 11, 2006, 05:48:47 pm »

Yes CPG does have PDG image. Is that why i pdf thumbnails not displaying? I really need it. How to get it work?Any extra coding?

I checked my code last night, and I don't have support in there to find a different image to use to represent pdf files.  Now, that just means that when I did that part, CPG did not come with one.

I will have to look into it more

Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #8 on: September 11, 2006, 05:49:39 pm »

Hi, i still can't get hot to display list of last added images [linked] in one column. Please help.

Example:
03/13/06   Misc - Just don't fit anywhere
01/11/06   Our furry friends
07/01/05   June 2005 - Becket Trip 0x02
06/05/05   Panthorn Park trails day 2005
12/07/04   Aug 2004 - My birthday at Session Woods
12/07/04   May 2003 - Becket Trip

But each items are linked to their post

I don't understand...
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #9 on: September 11, 2006, 09:47:23 pm »

Simply how to get the recent post in the gallery without the thumbnails. Just links.

Code below does not display anything. anything wrong?

         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");

$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(3, 3, "cat=2");

$cnt = 0;   
$arrayofalbums = array();

   foreach ($data as $row) {
      if (! in_array($row['aTitle'],$arrayofalbums)) {
         print date("m/d/y",$row['pCtime']);
         print "   ";
         print "";
         print $row['aTitle'];
         print "";
         print "
\n";
         array_push($arrayofalbums,$row['aTitle']);
         $cnt++;
         if ($cnt == 6) break;   
      }
   }
   $objCpm->cpm_close(); ?>
« Last Edit: September 11, 2006, 09:54:33 pm by dakwah »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #10 on: September 11, 2006, 10:42:54 pm »

Simply how to get the recent post in the gallery without the thumbnails. Just links.

Code below does not display anything. anything wrong?

..snip..


What you are doing there will only get a unique list of albums in the last 9 images that were added to catagory 2.

Is that what you want?  That may only be 1 thing in the list?

You may want something like this:
$data = $objCpm->cpm_viewLastAddedMediaFrom(100, 100, "cat=2");
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
[Solved] CPMFETCH CODE for Wordpress
« Reply #11 on: September 11, 2006, 11:02:43 pm »

i'll try that.

thanks vuud
Logged

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #12 on: September 12, 2006, 04:40:45 pm »

Nothing coming up when i put this code. WHY?

         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $data = $objCpm->cpm_viewLastAddedMediaFrom(100, 100, "cat=2");
        $objCpm->cpm_close();
         ?>

Links are all correct
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #13 on: September 12, 2006, 05:10:16 pm »

Nothing coming up when i put this code. WHY?

         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $data = $objCpm->cpm_viewLastAddedMediaFrom(100, 100, "cat=2");
        $objCpm->cpm_close();
         ?>

Links are all correct

Look at the source code for the page, do you see the php code?  Maybe its not processing it where you have stuck it
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #14 on: September 13, 2006, 01:05:42 am »

What does it mean i have stuck it, because when i try the same page by putting other such as simple code to post last added media buat showing thumbnails, it works fine.

Such as this;
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $options = array( 'subtitle' => '%t');
         $objCpm->cpm_viewRandomMedia(1,1, $options);
         $objCpm->cpm_close();
         ?>
But for this one... hmm don't know
         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $data = $objCpm->cpm_viewLastAddedMediaFrom(100, 100, "cat=2");
        $objCpm->cpm_close();
         ?>
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #15 on: September 13, 2006, 01:47:31 am »

         <?php
         include "../cpmfetch/cpmfetch.php";
         $objCpm = new cpm("/gallery");
         $data = $objCpm->cpm_viewLastAddedMediaFrom(100, 100, "cat=2");
        $objCpm->cpm_close();
         ?>

Try this

$objCpm->cpm_viewLastAddedMediaFrom(100, 100, "");

instead of the above.  You are all over the place.  Not sure what the $data = will do there... anyway, I am starting to suspect you don't have a category 2. 
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #16 on: September 13, 2006, 09:44:59 am »

Above works fine, but it displaying the pictue thumbnails as well.

I would like to display recent posts without thumbnails, and the all links in the recent post are linked to the original post.

Hmm... i do have 5 catagories, but probably the category is not numbered 1-5, is it?
« Last Edit: September 13, 2006, 09:54:56 am by dakwah »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #17 on: September 14, 2006, 04:18:18 am »

Above works fine, but it displaying the pictue thumbnails as well.

I would like to display recent posts without thumbnails, and the all links in the recent post are linked to the original post.

Hmm... i do have 5 catagories, but probably the category is not numbered 1-5, is it?


Hmmm, I wonder if there is anything in the documentation about this...
I wonder if anyone actual reads that stuff...

http://www.fistfullofcode.com/projects/copperminefetch/manual/ch06s02.html

Hint: second from the bottom



Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

dakwah

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: CPMFETCH CODE for Wordpress
« Reply #18 on: September 14, 2006, 05:18:23 am »

Thanks, vuud,

i did read that and try all of the examples on the test page. but i donno, not working on mine or whether my coding was wrong.

just need help to for code to display recent posts without thumbnails.

i also did try the function on the below;
$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(1000, 1000, "cat=5");

$cnt = 0;   
$arrayofalbums = array();

   foreach ($data as $row) {
      if (! in_array($row['aTitle'],$arrayofalbums)) {
         print date("m/d/y",$row['pCtime']);
         print "   ";
         print "";
         print $row['aTitle'];
         print "";
         print "
\n";
         array_push($arrayofalbums,$row['aTitle']);
         $cnt++;
         if ($cnt == 6) break;   
      }
   }

but seems not working... hmm... it's alright, thanks vuud, i'll do my best
« Last Edit: September 14, 2006, 05:25:20 am by dakwah »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: CPMFETCH CODE for Wordpress
« Reply #19 on: September 15, 2006, 05:11:36 am »

Thanks, vuud,

i did read that and try all of the examples on the test page. but i donno, not working on mine or whether my coding was wrong.

just need help to for code to display recent posts without thumbnails.

i also did try the function on the below;
$objCpm->cpm_setReturnType("resultset");
$data = $objCpm->cpm_viewLastAddedMediaFrom(1000, 1000, "cat=5");

$cnt = 0;   
$arrayofalbums = array();

   foreach ($data as $row) {
      if (! in_array($row['aTitle'],$arrayofalbums)) {
         print date("m/d/y",$row['pCtime']);
         print "   ";
         print "";
         print $row['aTitle'];
         print "";
         print "
\n";
         array_push($arrayofalbums,$row['aTitle']);
         $cnt++;
         if ($cnt == 6) break;   
      }
   }

but seems not working... hmm... it's alright, thanks vuud, i'll do my best


Try it with just "" instead of "cat=5" in there.  Can you give me a link to where it is running?
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco
Pages: [1]   Go Up
 

Page created in 0.034 seconds with 20 queries.