TinyPortal

Development => Block Codes => Topic started by: Nefeli on May 11, 2007, 08:25:38 PM

Title: Last and Random Media from coppermine gallery
Post by: Nefeli on May 11, 2007, 08:25:38 PM
Hi everybody

I have  installed SMF 1.1.1, TinyPortal v0.9.7, Coppermine Photo Gallery v1.4.10 and copperminefetch-2.0.0

After a lot of trials and many many
"Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /xxxxxx/xxxxxxx/xxxxxxxxxx/Sources/Load.php(1733) : eval()'d code(35) : eval()'d code on line 3" .
I accomplished to pass rightly the code in two diferrents (!!!) php blocks in front page of TP.

Finaly the combination that functioned ΟΚ was:

First php block:

echo "<CENTER>";
  include_once "./Gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./Gallery/cpmfetch/cpmfetch_config.php");
  $objCpm->cpm_viewLastAddedMedia(1,8);


Second php block:

echo "<CENTER>";
include_once "./Gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./Gallery/cpmfetch/cpmfetch_config.php"); 
$objCpm->cpm_viewRandomMediaFrom("cat=10,13",1, 8, $options);


Note that the codes resembles with those of previous tryals!!!!!

The codes dont work for hours and then, suddenly it works!!!!!!!!!!!!

This auto-correction happened on the same way, yesterday when i tryed again and again the first one!!!!!!!!!!!!

Sorry for my English  :'( I hope that you understand me and i am usefull for you all ::)





Title: Re: Last and Random Media from coppermine gallery
Post by: bloodynightmare on May 19, 2007, 06:24:01 PM
i tried both codes but it always tells me that ther'sn't the 'cpm' class on load.php in line 3
Title: Re: Last and Random Media from coppermine gallery
Post by: Nefeli on May 19, 2007, 07:50:32 PM
Quote from: bloodynightmare on May 19, 2007, 06:24:01 PM
i tried both codes but it always tells me that ther'sn't the 'cpm' class on load.php in line 3
ÃŽâ,,¢t is very important adapting the path on this in your server.
Mine is "./Gallery/cpmfetch/cpmfetch.php", gallery with G, your?
Still, the settings "cat=10,13",1, 8, $options etc. is the same or adapted to yours needs?
Title: Re: Last and Random Media from coppermine gallery
Post by: bloodynightmare on May 19, 2007, 08:02:41 PM
:p, you're right, i corrected the path, but still i don't understand what i have to put in cat= and $options... where have i to look up for these numbers?
Title: Re: Last and Random Media from coppermine gallery
Post by: Nefeli on May 19, 2007, 09:30:27 PM
Read for cmpfetch walkthrough here (http://cpmfetch.fistfullofcode.com/docs/stable_basic/index.html). There are more informations about.

ÃŽÅ"ore specifically for you >>>

Quote$objCpm->cpm_viewRandomMediaFrom("cat=1",1, 4, $options); // Line 5

The function call is named cpm_viewRandomMediaFrom - and with it, you tell CpmFetch to get random pictures from a specific source. All functions that end in "From" take the $source entry as the first parameter.

The source tag is one of the most powerful aspects of CpmFetch calls. It allows you to define (in simple terms) where to get images from.

In the documentation it will look like:

void cpm_viewRandomMediaFrom (mixed $source , int $rows, int $columns, [array $options = ""]);

Most of that will look familiar. The new one is $source. This is a string that you can pass in. Currently CpmFetch supports the following types to be passed in as a source: cat, album, owner, keyword, or text.

For now, we will focus on cat and album - these allow you to select specific categories and / or specific albums.

Most of the time you will be using something like:

"cat=5,6" - Use photos from categories 5 or 6

or

"cat=5,6:album=10" - Use photos from categories 5 or 6 or album 10.

Now, you can combine these however you want. The order does not matter, but you can only have one of each in your source string. You can list multiple entries by separating them with commas. Different types need to be separated by colons.

:)