Administrator
Administrator
fretzl   2010-10-30, 14:00
#1
Zenphoto version 1.3.1.2 [6110](nightly)

I'm using [i]printLatestNews()[/i] on gallery.php in a modified Zenpage theme. No problems so far.

But with the latest nightly I suddenly get this warning:
`Warning: get_class() expects parameter 1 to be object, null given in ...\zp-core\zp-extensions\zenpage\zenpage-template-functions.php on line 91`.
Member
Member
sbillard   2010-10-30, 17:43
#2
The error would be caused by calling this function without a parameter when the variable `$_zp_current_zenpage_news` has not been setup. For instance if you are not in a news loop or on a news page.
Administrator
Administrator
fretzl   2010-10-30, 18:03
#3
Thanks !
Should have known that by now ;-)
Still having a hard time with coding.
Administrator
Administrator
fretzl   2010-10-30, 18:31
#4
Although...
Isn't `printLatestNews()` supposed to set it up?
Member
Member
sbillard   2010-10-30, 19:29
#5
I would not expect so, What would it set it up to?
Administrator
Administrator
fretzl   2010-10-30, 21:11
#6
Sorry I'm at a loss here :-(

Until a few days ago I was able to use this function anywhere I wanted in Zenpage theme files without any additional coding.

Btw, thanks for implementing duplication of pages and articles!
Member
Member
sbillard   2010-10-30, 23:12
#7
Sorry, maybe I have confused you. Shortcut answers....

The error is coming from `getNewsType()`. Guess I had presumed you had looked at line 91. Anyway that function is not called from `printLatestNews()` so I presumed that you thought `printLatestNews()` might be supposed to store something into`$_zp_current_zenpage_news`. It does not and I do not know what it would set it to anyway.
Administrator
Administrator
acrylian   2010-10-31, 10:38
#8
`printLatestNews` should not require the `$_zp_current_zenpage_news` at all as it is meant to work outside Zenpage context at all (that it has the global definition is probably a leftover).

How does the code of the theme page look?
Administrator
Administrator
fretzl   2010-10-31, 11:26
#9
That's what I thought too :-)

Trying to figure this out I used the standard Zenpage theme and put `printLatestNews()` all the way at the bottom of [i]gallery.php[/i].

But I think I narrowed it down a bit.
`getNewsType()`(and subsequently `get_class()`) is called from `getNewsReadMore()`.
I guess it has something to do with the recent changeset `[6096]`.
Administrator
Administrator
acrylian   2010-10-31, 11:38
#10
I will take a look.

edit: Indeed, that's a bug related to the recent change to `getContentShorten()`
Administrator
Administrator
acrylian   2010-10-31, 12:38
#11
Should be fixed now.
Administrator
Administrator
fretzl   2010-10-31, 15:23
#12
Oh yes, working nicely again :-)
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.