Zenphoto v. 1.4.5.7 - WP integration broken & possible fix
@ sbillard/acrylian
NOT A "BUG":
Fatal error: Cannot redeclare build_query() in... WordPress/Includes/functions.
I really appreciate all the work you have put into Zenphoto and love using it!
I do know that you are not usually concerned about problems/conflicts with WordPress, but it would be nice if I could retain the functionality you intended when you revised the zp-core/functions-basic.php to add some features (sometime after vers 1.4.4.8, which works fine)
.
I have been using the "Ruzee hack" for years and have a lot of effort invested in customizing your default theme to work with WP, and am very happy with the results.
So, my question is... is there some way for you (or me) to rewrite a couple of your newer functions so as to _NOT_ use the term "build_query"?
Any feedback you care to give will be greatly appreciated. References to the two functions follow:
Zenphoto v. 1.4.5.7 - PATH: zp-core/functions-basic.php
==/ STARTING ON LINE 1056 [note: "createsa" is your typo, not mine]
/**
* createsa query string from the array passed
*
@param array $parts
*
@return string
* COMMENT-OUT BY NEIL 2013-1217 ************************************************************
*/
/**
`//function build_query($parts) {
// $q = '';
// foreach ($parts as $name => $value) {
// $q .= $name . '=' . $value . '&';
// }
// return substr($q, 0, -1);
}`
*/
==/ LINE 1138
/*
` $parts['query'] = build_query($pairs);`
* * COMMENT-OUT BY NEIL 2013-1217 ************************************************************
*/
Thanks in advance for your time!
Neil - a big fan of Zenphoto
Comments
The problem with your suggestion is that most likely there will always be functon names that conflict with other CMS. It is not WP itself (I am using it as well to build websites). There are other CMS ZP is used with. If we start to change things for other CMS where do we stop?
Best you open a ticket pointing here so the chief developer may decide to do this. I guess a simple "zp_" prefix would do it.
Thanks for your quick and thoughtful response. I like the "zp_" prefix solution.
It is 3:30 am my local, so I am not at my best. I will be happy to open a ticket, but it is not clear (to me) from your post where "here" is
I will be not back at the computer for several hours and look forward to further instructions.
Thx,
Neil
Your example is simply one of many issues that may occur. Changing names of functions is fraught with peril for our current users. If they have used the function then you have broken their code.
No real simple solution. But anyway, the proper solution is to use name spaces, but of course that is a bit of implementation and needed by both scripts.
Just that we are the dwarf and WP is the giant :-) But I actually agree.
I guess namespaces would be something for 1.5 or so (this could solve even the issue we had with the ApiGen doc generator complaining about same named classes, right?).
I have not yet opened a ticket. Pls advise if, based upon prior developer comments, a ticket is still needed re this matter.
I was hoping that the zp_ prefix was a possibility. Thanks for your time - I know that you are very busy. BTW, I have reverted to 1.4.4.8.
Unless others have comments, I will consider this thread closed.
Neil
The zp_ prefix would be possible, but of course that will break any code that uses the old function name. Since you are apparently the only one requesting this it seems not an advisable change. Break many for the sake of one. Besides which I am not at all sure that the change is all that will be needed to make things work. Last time I looked the way WP loaded plugins was in conflict with Zenphoto. Remember that Zenphoto is primarily a stand-alone application.
Of course you can apply this change to your copy of the code. Be sure you find and change all references. But you will need to remember to keep applying it on each update.
The ruzee way is actually the other way round including the WP header/footer stuff within a ZP theme. I have never used or tried this so I no knowledge what else might be the problem. If I use WP for a site I mainly use it standalone.
@avidre: I have to agree to my colleague that you being the only reporter of this issue is not enough demand to change such a significant thing. Sometimes we have to change things that break things for users but those are important issues (a conflict with another standalone CMS is not really, as there are probably some with other CMS as well - people tried unsuccessfully a bridge with Joomla as far as I know). We try to keep this to the necessary minimum to not break that much. That is why themes often require only minimum updates with new versions. WP has a similar, even stricter development policy.
I apologize for this long-winded post, but I wanted to let you know that there is someone else trying to integrate with WP in a dynamic way (not faking a static header). This is frustrating because I took a look at what is out there for photo gallery plugins for WP and I don't like any of them. You guys spoiled me. I like Zenphoto best, except it does not integrate easily (as far as I can tell).
All know resource regarding WordPress are here:
http://www.zenphoto.org/news/integrating-zenphoto-into-wordpress-tutorials
Of course all are third party so we don't know if they still work.
Beside that the general instructions here still apply:
http://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms
The "zenphoto as a plugin" way as mentioned does not work anymore because of a change in WordPress.
@acrylian and other ZP devs -- one of the reasons integrating into wordpress is useful, is because there are very advanced professional wordpress blogsite templates which people (like me) are purchasing for upwards of $300. If these blogsites had been built on ZP, then i'd just have gone that direction. Sadly that's not possible. So, supporting WP integration will get you integrated into better-looking more professional websites... that's a good thing for ZP right?
I don't know PHP well enough... doesn't it support some namespacing functionality to get around this issue?
The title of the page is broken, but that's my WP theme doing that
Zenphoto does not use namespaces yet. We eventually will do in the future but since that would require a lot of not pressingly needed changes that is not a priority right now.
We are aware that we need better themes. Still there is only so much time to do things. We can't do everything ourselves so we are dependent on others to contribute 3rd party ones (they even could sell).
And if you ever created your own site design/theme you will know that this is some work. I know it is a bit out of fashion to create own designs or hiring someone to do so (which is more expensive thatn $300) but instead rely on ready-made themes. Well, you don't always get what you wish for, do you? ;-)
Sure I completely understand. I just happened to discover that there was only 1 collision in my case, which was simple to fix, and I thought that'd be helpful for future folk to know.
I completely respect that "some assembly is required" if one wants to hack zenphoto inside another system like WP.
Keep up the great work.