Include Zenpage Posts in the Albums-Page

lamy Member
Hi!
Long time no see, I'm glad to see that Zenphoto is so successful! :)

I want to include the Zenpage posts in the Albums-View as follows:
Album 1 (13th of March)
Album 2 (14th of March)
News1 (15th of March)
Album 3 (16th of March)
News2 (18th of March)

and so on.

I have already managed to collect the timestamps and names of the zenpage posts and the albums and I have sorted them by the timestamps. The resulting array looks like this:

array(3) { [0]=> array(3) {
["Datum"]=> int(1343080800)
["Name"]=> string(9) "Test-Post"
["type"]=> string(4) "news" }
...
[2]=> array(3) {
["Datum"]=> int(1343141224)
["Name"]=> string(10) "Test-Album"
["type"]=> string(7) "gallery"
}

Now I am looking for a function like makeAlbumCurrent(); that I can use to output the albums.

Any suggestions? :)

Cheers!

lamy

Comments

  • acrylian Administrator, Developer
    I am not sure I exactly understand what you are trying to do. You want to list articles with the same date as an album on that album's page?

    Or do you just want to list articles and albums togehter as a kind of news page? Then the easiest is to do that on the news page and use the combinews mode "latest albums".

    In any case you should take a look at the object model.
  • I presume you mean a function you can use to make a news item current since `makeAlbumCurrent()` will indeed do so for an album. No such function currently exists. However the code you would want is:

    `
    save_context();
    add_context(ZP_ZENPAGE_NEWS_ARTICLE | ZP_ZENPAGE_SINGLE);
    $_zp_current_zenpage_news = new ZenpageNews($titlelink);
    `
    Where `$titlelink` is the title link of the news article (Which you do not yet have in your array.) You should do a `restore_context()` after you are done with the article.

    NOTE: this code has not been tested!
  • lamy Member
    Hey,

    thank you for your replies, I appreciate them. However, I have decided not to pursue that idea but to use ZenPages included functionality instead (pagination was too complicated for me).
    However, I have managed to get the album thumbnail displayed with the function

    $_zp_current_zenpage_news->getAlbumThumb();

    Is it somehow possible to get a custom album thumbnail?

    Thank you! :)
  • acrylian Administrator, Developer
    If you are using the COmbiNews mode you can set several things via the options that then are put out by `printNewsContent`.

    You can of course skip that and use the object model directly to do all manually. If the news item is an album object as in this case you can use all album class methods. Please see the functions documentation.
  • lamy Member
    Thanks for your reply!

    I have already tried everything I could think of to get it right, but I just can't. There is no method in the album class that returns me the custom thumbnail that I want. (920x400px).

    Letting the theme handling it is for various reasons not an option. Do you have another idea for me?
  • There is no method for that in the album class. However, the album class does have a method to return the thumbnail image and the image class does have a custom size method that can return a thumb the size you want.

    BTW, not sure about that size being a "thumb" even though you can do it. The difference between thumbnails and normal sized images (other than size) is the watermarking choices.
  • lamy Member
    Okay, apparentyl, I am too dumb for this :-(.
    Can you help me get this right?

    $img = newImage($_zp_current_zenpage_news, $_zp_current_zenpage_news->getAlbumThumb());
    $img->getCustomImage(920,920,250,920,250,100,100);

    Thanks! :)
  • acrylian Administrator, Developer
    You need to read the documentation correctly:

    If `$_zp_current_zenpage_new` is an album object:
    1 `$_zp_current_zenpage_new->>getAlbumThumb()` gets the URL to the album thumb image.
    2. `$_zp_current_zenpage_new->>getAlbumThumb()` gets the image object of the album thumb.
  • lamy Member
    FINALLY!!!
    OMG, IT WAS THAT EASY!
    *dancing*

    Thank you very much for your patience! :)
  • acrylian Administrator, Developer
    There was a typo actually. The first is "getAlbumThumb()" the 2nd should have been "getAlbumThumbImage()" of course.
Sign In or Register to comment.