Hi there,
I've just installed zenphoto and (partially) integrated it into my wordpress site with skins. It works beautifully on its own. Everything displays correctly.
However, on my homepage I want to also include some images from zenphoto. Unfortunately, when I use
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/zp-core/template-functions.php");
I get "MySQL Error: Zenphoto could not connect to the database server.Check your zp-config.php file for the correct host, user name, and password.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.Also make sure the server is running, if you control it."
I have checked zp-config.php multiple times and it is indeed correct. I feel pretty confident saying it's correct because when I visit my normal zenphoto gallery, everything works. It's just when I try to include the template functions on another page that it goes bananas.
I've spent about an hour googling and poking at the thing and nothing seems to work. Any thoughts?
Sorry, this is a known issue that the "zenphoto as a plugin" way sadly simply does s not work with Wordpress anymore. We were also not able to solve that as we don't know what and why Wordpress seems to override the db connection.
We solved that on zenphoto.org by using some custom Wordpress template functions to get the info directly without using Zenphoto functions (on the download page for the latest images for the screenshots, themes and showcase)-
On our extensions section there are also some Wordpress plugins to help.
To sbillard: Yes, that is where it is. Wordpress is also in the root, although not in a folder.
To acrylian: Interesting! I'm glad I didn't spend too much more time struggling with this, then. Do you have an example of these custom functions somewhere that you could link me to? The code itself, I mean. I will check out the plugins... All the ones I've seen so far work in posts, but not in templates, which is where I really need to work it in. I'll poke around somemore.
Thanks for your replies.
We have the same setup on zenphoto.org. We actually would like to find out why that including does not work but are stuck as we don't really know where to look right now.
Sorry, I don't have a link to those functions as I did them directly for our specific use to get the latest images directly from the zenphoto cache (I was too lazy to implement any image processing). I will take a look later if I maybe can generalize them a little.
Here we go: http://www.zenphoto.org/trac/attachment/wiki/ZenphotoPlugins/get-latest-zp-image-for-wp.zip
It is really basic, gets only one image as it was meant for that and has just quickly generalized. You will probably have to adjust and modify it a great deal for your purpose.
Hi Acrylian,
I've used your function to display latest images on index page of my wordpress website, but for a strange reason I get this error:
Query failed : Table 'morarte_zigu_test.zp_albums' doesn't exist
It seems that the function opens the DB of my wordpress installation and not the DB of Zenphoto Gallery installation, BUT I've made the right connection parameters in order to connect to the right DB...
Do you have any idea?
Thank you as ever..
Dimitri
How to modify so that I can get some n number of latest pics not from a album but latest images from overall gallery? I can't figure out since I have no experience of coding.
Any help?
Ok...I have found a proper WP Plugin...will try to fork it to work according to my needs.
Hi all, I have the same problem.
If I just call template-functions.php
require_once(WEBPATH . "/zp-core/template-functions.php");
it's ok, but, if I call it in some function, f.e.:
function init() { require_once(WEBPATH . "/zp-core/template-functions.php"); } init();
I have "MySQL Error: Zenphoto could not connect to the database server." message. Why?
p.s. sorry for my english.