print latest news content in ZP 1.4

hi,

i just upgraded to the latest 1.4 version of zenphoto. i am trying to get the content of the latest news. i used to be able to get it by calling `getLatestNews` and then getting the value of the `content` field of the returned array. obviously this is not possible anymore (the function does not return the content anymore). i tried `printLatestNews` but there is no option to get rid of the news title (which i don't want to be printed).

the solution i found is to call `getLatestNews` first then create a new `ZenpageNews` object using the titlelink returned by `getLatestNews` and finally get the content of the news using `->getContent()`. is this the solution ? if yes, i think it was a bit better before when the content of the latest news was returned within the array. it saved the creation of the object but maybe i am not doing this properly.

cheers,
frank.

Comments

  • What you did is the correct method. All of Zenpage is now object oriented. There is no array of the result. Not at all sure what is objectionable to you of creating the object. That would have to be done in any case. This is how printLatestNews does deal with it, for instance. The whole point of object models is to provide a means of abstracting the underlaying implementations such as the object storage.

    Of course if you would rather deal with an array, just make a wrapper function that gets the objects and then creates the array.
  • fair enough. i'll go with it. thanks for the answer.
  • acrylian Administrator, Developer
    Actually the object way is much more flexiblie. You or anyone else can now create your own very custom latest news function to include all other fields as well. That would be quite complictated with the old array way.
Sign In or Register to comment.