Zenphoto object requesting cannot be found

2»

Comments

  • acrylian Administrator, Developer
    If you want to tie the image to the top level parent in the album tree only you can also use this helper function:
    http://www.zenphoto.org/documentation/core/_functions.php.html#functiongetUrAlbum

    But besides that fretzl's way is the right one.

    he name is the name of the album folder)
    Actually it is the folder name including the parent album names if a sub album (topevel/sublevel1/sublevel2…).
  • Just for scuba the structure is parent scuba album - 4 sub albums - 1 subalbum has further 9 subs - each 9 has images.

    That will be too much coding. Perhaps no problem for the first time but every time a new album is added the coding will need to be done. e.g. just or 1 scuba album there will be three segments:

    if ($_zp_current_album->name == "scuba-diving")

    if ($_zp_current_album->name == "scuba-diving/photos")

    if ($_zp_current_album->name == "scuba-diving/photos/spain")

    + some code when the image is displayed

    I am not yet familiar with functions yet. If it has to be through functions then I guess I'll have to wait before I understand that, unless Fretzl posts some ready made stuff for me to paste :)

    Thanks
  • acrylian Administrator, Developer
    If you need a different image for each album/subalbum there is no way to do it differently. Except you could use either the random images functions or just use the album thumb of each album. There are functions for that.

    If you ony want always the same for all "scuba" subalbums as a "section" then use the uralbum function I linked.

    In any case you need to get a bit into it as we cannot post examples for everything as you might understand.
  • fretzl Administrator, Developer
    I'm in a good mood ;-)

    Maybe a different approach is easier once set up.

    The idea is to use de backend (admin) where you only have to fill in the filename of the image you want as header.

    This approach assumes that
    • You want to be able to set a specific header image for every album and/or subalbum.
    • The images are present in the images folder of the theme.

    On the backend all albums have a Codeblocks field.

    Go to admin -> albums -> scuba-diving and copy the image filename for the header (for example: scuba.jpg) in Codeblock#1
    Hit "Apply".
    Repeat this for every album and sub-album. Just pick the image you want.

    On album.php change
    `
  • @acrylian: "Always the same for all "scuba" subalbums as a "section" then use the uralbum function I linked."

    Thats exactly what I want i.e.

    if (url contains scuba-diving)

    {show scuba.jpg as the top header image for parent album and all downpath subalbums right till the image is displayed}

    else {header.jpg}

    but I dont know how to use the function you linked. I understand the concept of function but since just started php cant write the codes yet. Anyway I understand you cant write codes here for all visitors so its ok. I really appreciate the help I've got in the last few days.

    @fretzl: really appreciate your effort, thanks a lot. May you always be in a good mood :) Regarding the codeblock, it works fine for all the albums and sub-albums however the image code does not work. When you click on the thumbnail to open the image then only a black screen is displayed.

    Can you please include the option in the code that if there is nothing in the codeblock then the default header.jpg is displayed, since a new user might not know about the code block.

    I am really sorry I am asking too much from you guys but hopefully this is my last design issue.

    Regards
  • acrylian Administrator, Developer
    The usage is actually quite simple. You pass the current album object to it. That is stored in `$_zp_current_album` on album.php and image.php. The function will now return the album object of the oldest ancestor (the top level parent of it) or if it is itself the toplevel the album itself.

    So all you need to do is basically:
    `
    $obj = getUrAlbum($_zp_current_album);
    If($obj->name == 'scuba-diving') { … }
    `
  • fretzl Administrator, Developer
    Just to satisfy my own curiosity here's how to use the codeblocks. (tested this time)

    Make sure you have a header.jpg image in your images folder to serve as a default header image.

    In Codeblock#1 of the toplevel album paste/write the filename of the image to use as header (for example: scuba.jpg)

    On album.php and image.php replace

    `
  • Sorry again for coming in late (out on my flight again).

    Cant thank you guys enough. Everything is working fine. The codeblock thing is great as you dont have to mess around with the code everytime a new album is added.

    Much appreciated

    p.s. where r u guys based. cant find it on the website.
  • acrylian Administrator, Developer
    You get an idea where we are based looking here :-):
    http://www.zenphoto.org/pages/zenphoto-team
  • seen this page before, perhaps Germany and Netherlands. Dont fly to these stations anymore. I owe you guys a cup of coffee. I am in Paris today, come over :)
  • acrylian Administrator, Developer
    You did forget the USA :-) And we appreciate donations for our server instead of coffee, too :-)
  • yup that's a good idea
  • @fretzl

    what changes are required for the pages/news

    thanks
  • fretzl Administrator, Developer
    Sorry @haroon, I thought that would be relatively easy but I'm afraid it's beyond my coding skills.
  • acrylian Administrator, Developer
    It is actually the same principe (always the object model). For news articles it is even easier as they don't have parents. However, categories and pages can have parents. There is nothing for the top level item but there are methods to get all parents `->getParent()`. Those return an array you can get the top one from. Then again the object model comes in.
  • thanks, i am unable to run this.
  • coffee delivered
Sign In or Register to comment.