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: Using a few times cpmFetch.  (Read 12057 times)

0 Members and 1 Guest are viewing this topic.

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Using a few times cpmFetch.
« 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 :) :)
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Using a few times cpmFetch.
« Reply #1 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..
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #2 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? :)
« Last Edit: October 13, 2015, 05:07:28 pm by Phill Luckhurst »
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Using a few times cpmFetch.
« Reply #3 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.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #4 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
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Using a few times cpmFetch.
« Reply #5 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". 
Logged

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #6 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
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Using a few times cpmFetch.
« Reply #7 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
Logged
It is a mistake to think you can solve any major problems just with potatoes.

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #8 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 :)
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Using a few times cpmFetch.
« Reply #9 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).
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #10 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();
?>
Logged

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #11 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.
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Using a few times cpmFetch.
« Reply #12 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
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

kiki29

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Using a few times cpmFetch.
« Reply #13 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!
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 20 queries.