Pages (2): 1 2   
Member
Member
Jaanus   2012-04-29, 13:40
#1

Hi, after I upgraded to 1.4.2.3 (latest attempt was with latest nightly),

instead the gallery's main page I see error message
Fatal error: Call to a member function getNumImages() on a non-object in ..../zp-core/template-functions.php on line 1654

I can see and navigate inside albums by pointing directly to their address. But link to the main page on the top gives weird url - instead the proper gallery url there is additional /page/2/ at the end ( http://my.gallery.url/page/2/).

Downgrading to 1.4.2.2 solved the issue for this time.

Member
Member
sbillard   2012-04-29, 17:35
#2

What theme are you running? This error is because a function for returning the number of images in an album was called when there was not an album present. (As might be the case on the gallery index.)

Member
Member
Jaanus   2012-04-29, 22:15
#3

Default theme. It's "improved" copy for my needs but no matter - switching to the "original" default didn't help.

Member
Member
Jaanus   2012-04-29, 22:29
#4

Well, just tested one idea and now everything is OK.

Commented out 3 lines from template-functions.php
1624 - if (getNumImages()) {
1629 - }
1630 - return false;

The /page/2/ seems to be normal as albums in gallery index are on 2 pages.

Member
Member
sbillard   2012-04-29, 23:32
#5

Well, those lines of code reside in the function isImagePage() which does not appear at all in the Default theme. At least certainly not in the 1.4.2.3 nightly build.

Member
Member
Jaanus   2012-05-02, 12:52
#6

what are those lines exactly for? Maybe I miss now some useful feature?

Administrator
Administrator
acrylian   2012-05-02, 12:54
#7

Quote:Returns true if this page has image thumbs on it
Description of the function. Means this is an page with thumbs and not only subalbums.

Member
Member
Jaanus   2012-06-29, 23:43
#8

It's still problematic. Now after I installed a new version (nightly beta) the first gallery page just returned blank. Also with original "Default" template for 1.4.3!

Again I had to comment out these three lines in template-functions.php

Are you really sure that these lines are necessary? Without them my site works normally, no side effects.

function isImagePage() {
// if (getNumImages()) { //Jaanus commented out
global $_zp_page, $_firstPageImages;
$imagestart = getTotalPages(2); // # of album pages
if (!$_firstPageImages) $imagestart++; // then images start on the last album page.
return $_zp_page >= $imagestart;
//} Jaanus commented out
//return false; //Jaanus commented out
}

Member
Member
sbillard   2012-06-30, 03:23
#9

isImagePage() [b]STILL[/b] is not part of the standard Default theme! So commenting out those lines [b]CANNOT[/b] have any impact on it.

Member
Member
Jaanus   2012-07-02, 00:23
#10

OK, but how those lines in template-functions.php should make the newer versions better than 1.4.22 if they "CANNOT" have any impact?

Is it needed for other templates?

Where (in which file) to look for the bug?

May it be because php version is earlier than 5.3 (5.2.17) ?

Etc etc etc

Member
Member
sbillard   2012-07-02, 01:37
#11

If you are calling the function from a place not setup for it you will get an error. But the standard default theme does not use this function. Look in your changes.

Member
Member
Jaanus   2012-07-02, 14:44
#12

Indeed.... one separate test page shows everything without problems.

So I'm confused. Where could be the "place not setup for it"?

I'm pretty sure it should be somewhere else than theme files - as in my gallery page I got the same error with original "default" template where I hadn't changed anything.

Could some 3rd party plugin generate such error?

Member
Member
sbillard   2012-07-02, 18:46
#13

You should search for the use of isImagePage() since that is apparently the source of your problem. Certainly it could be being used by third party themes or plugins.

Member
Member
Jaanus   2012-07-03, 20:04
#14

Well, your hint helped me and the source of my problem was found on 1st attempt

It was zenFBcommon.php (from the Facebook plugin). I don't know why but error generating code was on line 84:

if (isImagePage()) {
echo '';
}

Perhaps you don't want to know how I solved it

At least temporarily it says now that "if this is not an album page":

if (!isAlbumPage()) {
echo '';
}

Tested. It works. Picture is normally posted to my FB wall.

Member
Member
Jaanus   2012-07-03, 20:30
#15

Have to be honest. I believed that I had the latest version of zenFBsuite, but updated it now just in case. And everything is fine without need to change somewhere the code.

Sorry for this panic

Administrator
Administrator
acrylian   2012-07-04, 09:00
#16

Good that we figured it out. I think those checks are not correct and meant to check the theme page. That should actuallyl be done by using the $_zp_gallery_pageand checks for album.php or image.php. I will point its developer to this topic so he can fix it.

Member
Member
micheall   2012-07-04, 18:12
#17

I'll take a look, but I never ran into any issues like that. What I was aiming for with the isImagePage() was attempting to use the function as the documentation said, which is "Returns true if this page has image thumbs on it"

Up until now this is the first I've heard of that being incorrect or having any errors. Did something change in the usage of this function?

Edit:
As a clarification, I understood the documentation to mean that it will return true if there's an image thumbnail on the page, no matter what page is loaded. For instance, a news page that has an image on that, for a FB link the user would most likely want to use one of the thumbnails from the news page and not their general image.

Administrator
Administrator
acrylian   2012-07-04, 18:35
#18

No, those functions did not change. isImagePage() is meant to check if we have thumbs on a album.php page if the album has images and sub albums. I agree that the doc is not really clear what this is about...

There is no way to check if there is any thumb in general on a page and specifically not on a news or pages page.

Your only chance is to check for the actual theme page.

Member
Member
micheall   2012-07-04, 19:30
#19

Hmm... ok I'll have to address this then. Thanks for the clarification.

Administrator
Administrator
acrylian   2012-07-04, 19:39
#20

Take a look at the html meta tags plugin as that does basically the same things technically.

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