forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: dakwah 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.
-
I split your post from the original thread because your question, though pertaining to wordpress, differs from the thread-starter's needs.
-
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
-
<?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...
-
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.
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...
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)
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.
-
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?
-
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
-
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
-
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...
-
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(); ?>
-
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");
-
i'll try that.
thanks vuud
-
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
-
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
-
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();
?>
-
<?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.
-
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?
-
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
-
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
-
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?