coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: leslie1970 on May 24, 2007, 10:54:17 PM

Title: php code not working from the gallery template
Post by: leslie1970 on May 24, 2007, 10:54:17 PM
I have installed and linked the code to my main site and it is working but when I use the same code on my gallery template the code doesn't work.  I have looked through the documentation and what I have looks right but I can't figure out what I am missing.

This is the php code i am using:

                                  <?php
                                    include "./gallery/cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
                                    $objCpm->cpm_viewRandomMediaFrom ("album=6,7,8",1,1);
                                    $objCpm->cpm_close();
                                  ?>


Like I said it works from my main site index but not in the gallery. I have tried several different paths to the cpmfetch.php file but I just can't seem to find the right path.

Any help would be greatly appreciated.  I am sure it is just some silly little thing I am missing!
Title: Re: php code not working from the gallery template
Post by: vuud on May 29, 2007, 07:33:12 PM
Quote from: leslie1970 on May 24, 2007, 10:54:17 PM
I have installed and linked the code to my main site and it is working but when I use the same code on my gallery template the code doesn't work.  I have looked through the documentation and what I have looks right but I can't figure out what I am missing.

This is the php code i am using:

                                  <?php
                                    include "./gallery/cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
                                    $objCpm->cpm_viewRandomMediaFrom ("album=6,7,8",1,1);
                                    $objCpm->cpm_close();
                                  ?>


Like I said it works from my main site index but not in the gallery. I have tried several different paths to the cpmfetch.php file but I just can't seem to find the right path.

Any help would be greatly appreciated.  I am sure it is just some silly little thing I am missing!

what gallery are you using?

Does its templates execute php?

What are the paths in question?

Title: Re: php code not working from the gallery template
Post by: leslie1970 on May 30, 2007, 12:48:06 AM
I am not sure what you mean by what gallery am I using but I assume you mean the version of coppermine?  I am using  (1.4.10).

I edited the classic template's style sheets and template.html.  I would hope that it will execute php.

The paths I have tried are:

                                    include "./gallery/cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");

                                    include "./cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("./cpmfetch/cpmfetch_config.php");

                                    include "/home/thekat5/public_html/gallery/cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("/home/thekat5/public_html/gallery/cpmfetch/cpmfetch_config.php");

                                    include "/cpmfetch/cpmfetch.php";
                                    $objCpm = new cpm("/cpmfetch/cpmfetch_config.php");

and pretty much every variation I could possibly think of.  Nothing works. I even tried using the html code I found in a thread here that only displayed one image (since that is all I want to display) and it did not work either.

I hope I answered everything correctly.  I am not a programmer by any means so I am trying my best to understand everything.
Title: Re: php code not working from the gallery template
Post by: leslie1970 on June 08, 2007, 08:57:55 PM
I'm still interested in any help I could get on this.  Thanks!
Title: Re: php code not working from the gallery template
Post by: Nibbler on June 08, 2007, 10:48:58 PM
A link to your gallery and to where you are using this code would probably help. You can't use php in the stylesheet or in template.html; you can only use php in php files.