forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: kiki29 on October 12, 2015, 10:45:14 pm

Title: Using a few times cpmFetch.
Post by: kiki29 on October 12, 2015, 10:45:14 pm
Hello!

I would like to know why the cpmFetch code doesn't work a few times on my site? I want to post the code on a few places, but on the same site. Even on the same page. Why the first bunch of photos is posted and the next bunch not?

I tried to find it on the net, but I really need to say... How can I find it?  It's kinda difficult. Use cpmFetch code a few times? No results :(

Maybe you can help me :) Thank you in advance :) :)
Title: Re: Using a few times cpmFetch.
Post by: gmc on October 12, 2015, 11:34:11 pm
A link to your site and the code you are using would be required for us to be able to help..
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 13, 2015, 04:45:54 pm
Okay. So here's my site: http://joannakrupa.us/  ***** EDIT - Please be aware this site is not suitable for work - Phill Luckhurst *****
And I want in my posts, instead of posting static links, insert the cpmfetch code to the right album.
As I tried it, it wasn't possible, cuz then, the fist code is loading, the rest not.  Why? :)
Title: Re: Using a few times cpmFetch.
Post by: phill104 on October 13, 2015, 05:13:47 pm
As per the board rules, we are happy for users to post links that contain appropriate nudity etc but they must be marked as "Not Suitable For Work" as per our board rules. Many companies will not hesitate to sack people for even the mildest breach of their company rules hence the need for the warning.

A link to your site and the code you are using would be required for us to be able to help..

As per above, please provide the cpmfetch code you are trying to insert.
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 13, 2015, 05:28:46 pm
Oh sorry...  Didn't thought it's that 'nude'. Okay, now I'm in :)

So here is my code:

<?php
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  $options = array('windowtarget' => '_blank');
  $objCpm->cpm_viewRandomMediaFrom("album=194",1, 4, $options)
  $objCpm->cpm_close();
?>

This is my example for one album. Now I want to copy it a few times and then just put another albums in it. This code is also in my sidebar:

<?php
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  $options = array('windowtarget' => '_blank');
  $objCpm->cpm_viewLastAddedMedia(3,2,$options);
  $objCpm->cpm_close();
?>


Hope I have it all right now :D
Title: Re: Using a few times cpmFetch.
Post by: ron4mac on October 13, 2015, 08:42:12 pm
You need to figure out why the images are trying to be accessed from "joanna-krupa.org" instead of "joannakrupa.us". 
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 13, 2015, 09:33:11 pm
Nope, that's not the problem. The error code I get is this one:

Parse error: syntax error, unexpected ‘$objCpm’ (T_VARIABLE) in /home/joannakr/public_html/wp-content/plugins/runPHP/runphp.php(410) : eval()’d code on line 6

My sidebar is loaded, but my post not. Just take a look: http://joannakrupa.us/?p=406
Title: Re: Using a few times cpmFetch.
Post by: phill104 on October 13, 2015, 10:19:03 pm
As per gmc, all those images not showing at the bottom are linked to the .org domain, not .us

Please check the setting you have in your config here - http://documentation.coppermine-gallery.net/en/configuration.htm#admin_general_coppermine-url
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 13, 2015, 11:00:51 pm
Oh, the pictures at the bottom are from my codes. I add them a time ago by myself. I have trouble with the post, I posted the link :) The other pictures aren't the problem :)
Title: Re: Using a few times cpmFetch.
Post by: gmc on October 14, 2015, 01:23:32 am
The error code I get is this one:

Parse error: syntax error, unexpected ‘$objCpm’ (T_VARIABLE) in /home/joannakr/public_html/wp-content/plugins/runPHP/runphp.php(410) : eval()’d code on line 6
From the error message - you are using a Wordpress Plugin that allows you to include PHP code - and in that code you have included the CPMFETCH call...
The wordpress plugin processes the PHP using the 'eval' function - and is finding a syntax error in your code - an unexpected T_Variable..
I would suspect a missing ; at the end of the preceding line (line 5)... but you will need to post your code being executed by that plugin to see more (your code... not the plugin itself).
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 14, 2015, 01:27:08 pm
Yes, I checked it.

When I put after my   
Code: [Select]
$objCpm->cpm_viewRandomMediaFrom("album=194",1, 4, $options)  a ; then this shows up:

Code: [Select]
Fatal error: Cannot redeclare class cpm in /home/joannakr/public_html/gallery/cpmfetch/cpmfetch.php on line 0
Then the whole site can't be loaded.

Here the whole code:

Code: [Select]
First photos:
<?php
  
include "./gallery/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  
$options = array('windowtarget' => '_blank');
  
$objCpm->cpm_viewRandomMediaFrom("album=194",14$options);
  
$objCpm->cpm_close();
?>


Second photos:
<?php
  
include "./gallery/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
  
$options = array('windowtarget' => '_blank');
  
$objCpm->cpm_viewRandomMediaFrom("album=195",14$options);
  
$objCpm->cpm_close();
?>
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 14, 2015, 01:28:33 pm
Sorry, I can't find the edit button...

I wanted to ask, if this was the code you ask for? It's only the code I put into my post.
Title: Re: Using a few times cpmFetch.
Post by: gmc on October 14, 2015, 01:37:32 pm
ok... The 'include' statement should only appear once on a page... Trying to include the same file twice is causing the fatal error...
Change 'include' to 'include_once' and PHP will properly load the file the first time, and ignore it the rest...

(alternately you could delete the second 'include' statement... But with multiple posts, which one is first will change over time.)

More complete descriptions initially will help us help you quicker..  :)
Greg
Title: Re: Using a few times cpmFetch.
Post by: kiki29 on October 14, 2015, 01:47:53 pm
Thank you  gmc   soooooo much! ♥ It worked!

Now I know more :D And also how to post here ;)

Thank you!