Pages (2): 1 2   
Member
Member
kgenly   16-12-2009, 03:17
#1

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?

Member
Member
sbillard   16-12-2009, 04:45
#2

You have not told us what the structure of your site is. For instance, is Zenphoto installed in the /zenphoto folder?

Administrator
Administrator
acrylian   16-12-2009, 10:16
#3

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.

Member
Member
kgenly   16-12-2009, 10:40
#4

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.

Administrator
Administrator
acrylian   16-12-2009, 11:00
#5

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.

Member
Member
kgenly   16-12-2009, 20:18
#6

That would be an ENORMOUS help. It'd be great to at least have a place to jump off from.

Administrator
Administrator
acrylian   16-12-2009, 20:57
#7

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.

Member
Member
ziguline   22-12-2009, 13:13
#8

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

Administrator
Administrator
acrylian   22-12-2009, 13:24
#9

Do you really first used the function to connect to the database of Zenphoto and then the one for the latest image? Double, triple check the db details. It is working on our site although in a modified version.

Member
Member
ziguline   22-12-2009, 13:27
#10

As I did...

Member
Member
ziguline   22-12-2009, 13:28
#11

code in the function.php

`

Administrator
Administrator
acrylian   22-12-2009, 13:42
#12

You first have to call connectZenphotoDB() with your db details. It does not do anything by itself...

Member
Member
ziguline   22-12-2009, 14:40
#13

You are right!

now I'm struggling with the right name of image in the cache ; )

Thank you.

Have a nice Christmas Time!

Dimitri

Administrator
Administrator
acrylian   22-12-2009, 15:03
#14

Well, yeah, it's just a hacked workaround until we hopefully find out why the "plugin way" does not work anymore.

Member
Member
navjotjsingh   25-12-2009, 12:44
#15

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?

Administrator
Administrator
acrylian   25-12-2009, 13:02
#16

Sorry, you will have to learn a few things to do it yourself. You will understand that I can't do that for you.

Member
Member
navjotjsingh   25-12-2009, 13:15
#17

Ok...I have found a proper WP Plugin...will try to fork it to work according to my needs.

Junior Member
Junior Member
rezo.kun   03-01-2010, 17:49
#18

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.

Administrator
Administrator
acrylian   03-01-2010, 19:05
#19

You can't place function definitions within function definitions...

Member
Member
sbillard   03-01-2010, 19:16
#20

Which means you must do the require+once() outside of the function otherwise the functions it defines are not available outside that function itself.

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.