I got a link to their Coppermine profile showing up in their SMF profile (nothing to do with cpmFetch) but I also want to get 3 images from that person as well.
If I use this:
$objCpm = new cpm("/photos");
$objCpm->cpm_viewLastAddedMediaFrom(3,1,"owner=Mom");
$objCpm->cpm_close();
It works fine... but that's hardly dynamic (hardcoding the person's username in).
I tried:
$objCpm = new cpm("/photos");
$objCpm->cpm_viewLastAddedMediaFrom(3,1,"owner= $context['member']['name'] ");
$objCpm->cpm_close();
And I'm getting an error:
"Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in... .../Profile.template.php on line 259"
I also tried:
$objCpm = new cpm("/photos");
$objCpm->cpm_viewLastAddedMediaFrom(3,1,'"owner='$context['member']['name']'");
$objCpm->cpm_close();
and end up this error:
"Parse error: parse error, unexpected T_VARIABLE in .../Profile.template.php on line 259"
Any help would be SOOO appreciated and I might actually send money or gifts ;)
FINALLY... I figured it out. Ya know, it would help if I knew PHP more.
code that finally worked:
$objCpm = new cpm("/photos");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
I have a problem with your code
I'v included it on a test.php page
<?php
error_reporting(E_ALL);
ini_set('display_errors',1); // 0 is off, 1 is on
include "cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
?>
But I get this error:
Notice: Undefined variable: context in /home/site.com/public_html/galerie/cpmfetch/test.php on line 7
Please help
How do you expect it to work on a test page? It needs to be on the SMF profile page.
Ok I have added this code
include "galerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
on Profile.template.php but I get this error
Fatal error: Cannot instantiate non-existent class: cpm in /home/site.com/public_html/smf/Sources/Load.php(1770) : eval()'d code on line 312
Quote from: asterix23 on January 04, 2007, 05:43:24 PM
Ok I have added this code
include "galerie/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galerie");
$source = "owner={$context['member']['name']}";
$objCpm->cpm_viewLastAddedMediaFrom(3,1,$source);
$objCpm->cpm_close();
on Profile.template.php but I get this error
Fatal error: Cannot instantiate non-existent class: cpm in /home/site.com/public_html/smf/Sources/Load.php(1770) : eval()'d code on line 312
try changing to include_once ...
I think your path is screwy and include_once if I remember correctly fails harder and more apparent.
fixed thanks!
but there are a problem with members who have a different Username and Displayname, maybe you should use $context['member']['id'] instead of $context['member']['name'] ?
Hey.. i try to set in the code.. but i'm not shure where to set it...
can som 1 tell me a line to set it in? and what file?
thank you :D