Hi,
I have successfully installed zenphoto on my server and it is working flawless. Now I would like to fetch latest images and random images on website’s main page which is outside a Zen folder, I have named “zenphoto†to “portfolioâ€.
Following is my previous working code:
<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'portfolio');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>
<?php
printRandomImages();
?>
Above code is not working with a new version of ZenPhoto, any help will be highly appreciated?
Thanks and regards
Comments
Thanks for your reply; following is my directory structure on my local host:
Inetpub
|___Website 01
|___Website 02 (… and so on)
|___Website (it has a zenphoto)
|___index.php (with above posted script on root of that folder)
|___Portfolio (renamed from zenphoto to portfolio and the rest of structure is same as zenphoto)
I hope it will help you to understand a situation, if not and would like to ask some more information then kindly ask me and I will be glad to pass you most appropriate info which I could.
Thanks and regards
The site structure is site.com/zentest/
This is my code
`<?php<br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zentest');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
Test Index
<?php printImageStatistic (6, latest) ?>
`
And this is the error:
Fatal error: Call to undefined function: zp_error() in /home/xxxx/public_html/test/zp-core/functions-db.php on line 35
Fatal error: Call to undefined function: zp_error() in /home/xxxx/public_html/zentest/zp-core/functions-db.php on line 35
Btw, don't know if it helps, but if I change WEBPATH to the full path (http://site.com/zentest)this is what I get:
Fatal error: Call to undefined function: printimagestatistic() in /home/xxxx/public_html/test.php on line 11
This is what the error log says, basically the same warning as the one in the browser
[02-Sep-2008 17:28:54] PHP Fatal error: Call to undefined function: zp_error() in /home/xxxx/public_html/zentest/zp-core/functions-db.php on line 35
I c/p the function as it is and it's working inside the gallery so I assume the database is ok. I have no idea why it is not connecting.
Do you know what else I can change/check?
There really should be no way that this error can occur--the `zp_error()` is defined in functions.php which is included at the beginning of functions-db.php so should really exist.
You can modify the code in functions-db.php to give us some more information:
`if (!$mysql_connection) {`
insert here: `echo '
$_zp_conf_vars: ';print_r($_zp_conf_vars);`
`
zp_error(gettext('MySQL Error: Zenphoto could not connect to the database server.')
.gettext('Check your zp-config.php file for the correct host, user name, and password.')
. gettext('Note that you may need to change the host from localhost if your web server uses a separate MySQL server, which is common in large shared hosting environments like Dreamhost and GoDaddy.')
. gettext('Also make sure the server is running, if you control it.'));
return false;
}
`
NOTE: this will display your MySQL user and password, so you want to do this, capture the result, and then take it out.
$_zp_conf_vars:
Fatal error: Call to undefined function: zp_error() in /home/gsrfanco/public_html/zentest/zp-core/functions-db.php on line 36
and this is the code (line 34 and on):
`
if (!$mysql_connection) {
echo '$_zp_conf_vars: ';print_r($_zp_conf_vars);
zp_error(gettext('MySQL Error: Zenphoto could not connect to the database server.')
.gettext('Check your zp-config.php file for the correct host, user name, and password.')
. gettext('Note that you may need to change the host from localhost if your web server uses a separate MySQL server, which is common in large shared hosting environments like Dreamhost and GoDaddy.')
. gettext('Also make sure the server is running, if you control it.'));
return false;
}
`
The structure:
root folder (it has the file with the script)
|__zentest
If you don't mind continuing to debug this through this thread, you can add another line to the above code `
echo current directory: '.getcwd(); echo '
zp-config.php ';if (file_exists('zp-config.php') echo ' found'else echo 'not found';`
We will see what this tells us and go on from there.
I changed it to:
`
if (!$mysql_connection) {
echo '$_zp_conf_vars:';
print_r($_zp_conf_vars);
echo '
current directory: '.getcwd();
echo '
zp-config.php ';
if (file_exists('zp-config.php')
echo 'found';
else
echo 'not found';
`
and I have an unexpected T_ECHO on line 38 but I don't know how to fix this.
`
echo '$_zp_conf_vars:';
print_r($_zp_conf_vars);
echo '
current directory: '.getcwd();
echo '
zp-config.php ';
if (file_exists('zp-config.php'))
echo 'found';
else
echo 'not found';
`
$_zp_conf_vars:
current directory: /home/xxxx/public_html
zp-config.php not found
Fatal error: Call to undefined function: zp_error() in /home/xxxx/public_html/zentest/zp-core/functions-db.php on line 44
The site structure now is
root
\folder
\zenphoto
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'photos');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
require_once(WEBPATH . "/" . ZENFOLDER . "/plugins/image_album_statistics.php");
?>
<?php printLatestImagesByMtime(7); ?>
I have this code in a test page, it's working but all the thumbnails are broken
The html output:
< a href="photos/Miscellaneous/image_001.jpg.php" title="image_001">
< img src="photos/cache/Miscellaneous/image_001.jpg_100_thumb.jpg" alt="image_001" />
Using an absolute path would fix it but I don't know what to change. I tried
define('WEBPATH', '/photos') but it gives me this error
Warning: require_once(/photos/zp-core/template-functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/xxx/public_html/test/zen.php on line 4
Fatal error: require_once() [function.require]: Failed opening required '/photos/zp-core/template-functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/test/zen.php on line 4
my site structure is
public_html/test/photos
Probably the printLatestImagesByMtime() function was not coded to be able to be called anywhere but from the zenphoto index.php folder.
public_html/test/photos
the page is in 'test'
public_html/test/zen.php
<?php
define('WEBPATH', '/photos');
require_once(photos. "/" . zp-core. "/template-functions.php");
require_once(photos. "/" . zp-core. "/plugins/image_album_statistics.php");
?>
Warning: require_once(0/template-functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/xxx/public_html/test/zen.php on line 3
Fatal error: require_once() [function.require]: Failed opening required '0/template-functions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/test/zen.php on line 3