Customizing the front page content

I have this project I've been working on that will involve drawing a small picture each day and uploading it to a gallery. After looking at some alternatives, ZenPhoto looks like it might be the best for this, but I'm trying to figure out how to hack together a custom front page using Zen's theme system:

I want the front page to display the latest image at a large size (like 760 x 380), maybe even followed by thumbnails of the five or so next latest. Anyone know what code I might be able to do this with? Thanks!

Comments

  • You can do that easily by creating a custom theme.

    You'll need access to some of the image-context functions. You'll need to use the set_context() function to have access to those.
  • I'm starting to get the idea, but I think I just need a crash course in zen theming. That said, do you know where I can find a mirror of what appears to be the howto guide (http://www.zenphoto.org:8080/confluence/display/DOC/How+to+Make+a+ZenPhoto+Theme) while the Wiki's down?
  • Hahaha. That was my tutorial. Let me see if I have a local copy...

    Grrr.... I don't. Sorry. I'll try and rewrite it this weekend.
  • Sorry, I didn't get a chance to do this. I had a family emergency come up this past weekend. Now that the Wiki is back up, we'll see if we can get it going again.
  • Sorry to hear, I hope everything is all right.

    After some poking around with the theme files, I think I see what to use to display the image itself, so I guess it would be a question of how to use set_context() before the image call. Would you (or any themers who might happen across this) be able to fill me in a bit on how this one function works?
  • when using the set_context function, there are several contexts available to you. They are:
    ZP_INDEX
    ZP_ALBUM
    ZP_IMAGE
    ZP_COMMENT
    ZP_GROUP

    I'm not too sure as to what the group context is all about since I haven't delved into the new code yet, but let's take the album context as an example.

    Themes will have an index.php -- this file shows a listing of all the albums. When you click on one of the albums, you're now using album.php. This is basically what handles the display of the albums page (where all the thumbnails for the images are shown). It is in this file that your context is automatically set to ZP_ALBUM. This allows album.php to have access to all of the functions that affect albums such as getting the album's title, getting the album's date, getting the album's thumbnail, etc.

    In your case, you'll want to manually set the context to ZP_ALBUM but you'll want to do that inside index.php. The context that is automatically set inside index.php is ZP_INDEX. This means that you won't have access to the album fucntions. This is why you'll need set it manually.

    So, you use the set_context() function by the following:

    `... ...

    set_context(ZP_ALBUM);



    set_context(ZP_INDEX);

    ... ...`

    That's all.
  • GameDudeX-

    I think this explanation you gave shouldn't be lost in the forums. It should be immortalized in the wiki. ;)

    I stuck it under http://www.zenphoto.org/trac/wiki/DeveloperReference#Functions in the Developer Reference on the wiki, and it can be edited as necessary from there. I needed to edit it a bit from the first person perspective, so take a look and see what you think.
  • thanks thinkdreams, but I was thinking of creating a more "formal" context explanation... haha... I guess this would do for now though. :P
  • Go for it. The wiki is highly editable. I'm just trying to "fill" it out a bit. It looks so lonely and barren being so new and all. Kind of like Charlie Brown's Christmas Tree. Needs a little care and feeding.

    :)
  • Thanks, that explains a lot! So say I've set the context to ZP_IMAGE in preparation to call up the large-size version of the latest image on the home page:

    `set_context(ZP_IMAGE);

    printDefaultSizedImage(getImageTitle());`

    Is there a function similar to set_context() to set the current image that will be fetched by printDefaultSizedImage() ?
  • No. Usually printDefaultSidezImage() gets information from the image that is currently being viewed. I do see a getImageID() function, but there's no way to affect images based on their image id -- yet. This may be something that is implemented in later versions of ZenPhoto.
  • Thanks for your help, everyone. After some hard thinking, it looks like I may in truth be trying to reinvent the wheel here -- ZP looks like an excellent gallery app, but I think the functionality I'm actually looking for is a photoblog instead of a gallery (I'm finally seeing the distinction). Apps like CFCPhotoBlog ( http://www.leavethatthingalone.com/photos/ ) may not offer the sorting and management features of ZenPhoto, but I think for what I'm looking at doing, it's probably a better fit.

    Good luck with the development. If I decide I need a full-on gallery later, I'll know where to go!
Sign In or Register to comment.