i've setup a basic php page that is nothing but the default setting as described in the howto:
`code`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head><?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', '
http://mysite.com/gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "
<img src='".
$randomImage->getSizedImage(getOption('image_size')) .
"' alt=\"random image\"\n" . $randomImage->getTitle() .
'" />';
?>
<body>
</body>
</html>
`code`
but i'm getting this error:
Fatal error: Call to undefined function: getrandomimages() in /xxxxx/index.php on line 12
any ideas?
i'm not trying to use it as a plugin for any CMS type systems.. just straight PHP pages i've already got setup on my site.
Comments
Fatal error: main() [function.require]: Failed opening required 'gallery/zp-core/template-functions.php' (include_path='.:/usr/lib/php') in /homepages/10/xxxxxx/htdocs/xxxx/test/index2.php on line 10
i've also tried the full server path to folder, and the domain base path .. all without results.
what does '(include_path='.:/usr/lib/php')' mean??
yet the gallery functions perfectly from the gallery install folder.
i'm trying to use the function on other pages in my site that are not in the zenphoto folder.
with:
define('WEBPATH', '../gallery');
i get:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/10/xxxxxx/htdocs/xxxx/test/index2.php:6) in /homepages/10/xxxxxx/htdocs/xxxx/gallery/zp-core/functions.php on line 1561
Zenphoto Error
MySQL Query ( SELECT `zp_images`.filename,`zp_images`.title, `zp_albums`.folder, `zp_images`.show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` INNER JOIN `zp_albums` ON `zp_images`.albumid = `zp_albums`.id WHERE `zp_albums`.folder!="" AND `zp_albums`.show=1 AND `zp_images`.show=1 ORDER BY RAND() LIMIT 1 ) Failed. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` I
so far these are not working:
define('WEBPATH', 'gallery');
define('WEBPATH', 'http://mysite.com/gallery');
define('WEBPATH', '../gallery');
define('WEBPATH', '/homepages/10/xxxxxx/htdocs/xxxx/gallery/');
thank you
.. but this is the 'folder structure' of the site:
zenphoto folder is in http://mysite.com/gallery
the 'SERVERPATH' to it is /homepages/13/d101687662/htdocs/mysite/gallery
i'm trying to do a test in a folder called 'test' that sit at the root
so that would be http://mysite.com/test
in this folder i have the basic 'plug-in' code in an index.php file that only has the copy and pasted code for using zenphoto as a plugin (this is the 1st post of this topic)
i've tried all of the
define('WEBPATH', 'gallery');
that i could think of ... as listed just above.
i think that all of the information on it.
would the .htaccess have anything to do with this?
i've got an .htaccess for the root re-writes and another one in the zenphoto location.
i'll try some tests with the .htaccess file disabled at the root....
Fatal error: main() [function.require]: Failed opening required '/gallery/zp-core/template-functions.php' (include_path='.:/usr/lib/php') in /homepages/13/d101687662/htdocs/mysite/index3.php on line 11
this is the body of my index3.php testing file:
-----------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body><?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', '/gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "<img src='".
$randomImage->getSizedImage(getOption('image_size')) .
"' alt=\"random image\"\n" . $randomImage->getTitle() .
'" />';
?>
</body>
</html>
---------------------------
when using:
define('WEBPATH', 'http://mysite.org/gallery');
this error:
Fatal error: Call to undefined function: getrandomimages() in /homepages/13/d101687662/htdocs/mysite/index3.php on line 13
when using:
define('WEBPATH', 'gallery');
this error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/13/d101687662/htdocs/mysite/index3.php:7) in /homepages/13/d101687662/htdocs/mysite/gallery/zp-core/functions.php on line 1561
Zenphoto Error
MySQL Query ( SELECT `zp_images`.filename,`zp_images`.title, `zp_albums`.folder, `zp_images`.show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` INNER JOIN `zp_albums` ON `zp_images`.albumid = `zp_albums`.id WHERE `zp_albums`.folder!="" AND `zp_albums`.show=1 AND `zp_images`.show=1 ORDER BY RAND() LIMIT 1 ) Failed. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` I
and the same error if i place the entire server path in
define('WEBPATH', '/homepages/13/d101687662/htdocs/mysite/gallery');
i appreciate trying to help out, thanks.
as shown in the above posts:
define('WEBPATH', 'gallery');
and
define('WEBPATH', 'http://mysite.org/gallery');
means that 'zenphoto' is a subfolder of the mainsite renamed to 'gallery'
is this what you mean?
============================
i would be willing to offer FTP access to the zenphoto dev team to work out this fix. i run a Managed 1&1 Dedicated Server that has given me no problems with any installs including: Joomla(and all of its components,modules,plugins), Wordpress (+plugins), phpCalendar and so on. i think it would be worthwhile for this to be solid and working trouble-free for the future of Zenphoto users. i have posted all of my code and i am a developer too - so by all means this 'zen as plugin' should be working by now if it was bug-free.
One thing you could try is setting path overrides at the bottom of your zp-config.php file. Some servers need that to run Zenphoto successfully.
This case has the calling index.php in the root folder and zenpoto install in the /zenphoto folder. Here is the PHP:
`<?php <br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
//load extensions
$_zp_plugin_scripts = array();
$_zp_flash_player = NULL;
$curdir = getcwd();
chdir(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER);
$filelist = safe_glob('*'.'php');
chdir($curdir);
foreach ($filelist as $extension) {
$opt = 'zp_plugin_'.substr($extension, 0, strlen($extension)-4);
if (getOption($opt)) {
require_once(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension);
}
}
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
Test Index
<?php <br />
$images = getImageStatistic(6, "latest");
foreach ($images as $image) {
echo "
$imageURL = getURL($image);
echo '
$image->getTitle() . '">
$image->getCustomImage(null, 44, 44, null, null, null, null, true) .
'" alt="' . $image->getTitle() . "\"/>n";
echo "
}
printRandomImages();
?>
`
thanks for the above example!
i am still getting errors but i've taken out enough to be error free and display the images/titles/links.
this is my code now (error free):
`<?php<br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
TEST
<?php<br />
$images = getImageStatistic(6, "latest");
echo "
echo "";
$imageURL = getURL($image);
echo '
$image->getTitle() . '">
$image->getCustomImage(null, 100, 100, null, null, null, null, true) .
'" alt="' . $image->getTitle() . ""/>n";
echo "". $image->getTitle()."";
}
echo "
?>
`
=====================
BUT - notice that i needed to remove the function
`printRandomImages();`
if i leave that in it gives me this error:
`# Zenphoto Error
MySQL Query ( SELECT `zp_images`.filename,`zp_images`.title, `zp_albums`.folder, `zp_images`.show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` INNER JOIN `zp_albums` ON `zp_images`.albumid = `zp_albums`.id WHERE `zp_albums`.folder!="" AND `zp_albums`.show=1 AND `zp_images`.show=1 ORDER BY RAND() LIMIT 1 ) Failed. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` I`
=======================
and i needed to modify the top pre-header php in order to be error free like so:
`<?php<br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'gallery');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
//load extensions
$_zp_plugin_scripts = array();
$_zp_flash_player = NULL;
$curdir = getcwd();
//chdir(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER);
$filelist = safe_glob('*'.'php');
chdir($curdir);
foreach ($filelist as $extension) {
$opt = 'zp_plugin_'.substr($extension, 0, strlen($extension)-4);
if (getOption($opt)) {
require_once(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension);
}
}
//header ('Content-Type: text/html; charset=' . getOption('charset'));
?>`
it was causing errors on the following lines:
`//chdir(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER);
//header ('Content-Type: text/html; charset=' . getOption('charset'));`
with this i will continue working on it and try to see why it is getting errors on the function calls like: `printRandomImages();`
thanks again
i am interested in the same thing as:
http://www.zenphoto.org/support/topic.php?id=2165&replies=4#post-12797
which is displaying the getImageStatistic on only a certain album and not the entire gallery. has that been implemented into the current nightly build?
acrylian has stated in the topic that it would be, but there is no definite follow up that says it has been.
+ i can't seem to find 'getImageStatistic' function in the documentation. i have used FireFox to 'search' for it within every page of the online userguide and it is not showing up. where will i find its docs?
1. the main gallery page (index.php) shows no thumbnails - yet no errors too - after re-cache.
2. the album page (album.php) displays fine but the link back to the (index.php) is `path to ablum +
Warning Division by zero in +server path stuff...` and that error remains on all instances of that link on other pages.
3. the image page (image.php) dispays fine
4. the link to the Archive page displays the same errored link as in #2 on all pages.
........................
this is in the normal gallery - not the 'zen as plugin'
the normal gallery was working 100% fine before the upgrade to the nightly build.
i am posting now to the bug tracker.
You have a really weird server...:-( I have neither any idea what that causes nor am I able to reproduce it with the latest nightly.
Probably some files are not updated correctly. Did you try disabling mod_rewrite or may I dare to suggest a clean reinstall...?
then i can give you some real URLs to look at.
thanks so much for the help.