Gallery on the front-page

Hi

I am trying to find out how to put a specific gallery on the front-page of my website. So the code should go in index.php

I see that there are function like zp_load_gallery but I can not find a way to achieve what I want with those or if it is even the right way to do it with that function.

To be clear I don't want an album link on the front page but the gallery itself with the thumbnails and pagination. Basically the front page should look like what you see after you click on an album link.

My experience with php is limited so a piece of example code would be greatly appreciated

Comments

  • acrylian Administrator, Developer
    edited May 2020

    Let me first correct the terms uses: "gallery" refers to the Zenphoto site in total, you are referring to a single "album".

    My experience with php is limited so a piece of example code would be greatly appreciated

    Sorry, then you will not really far here. There is no simple code for this as this is off the standard.
    First you should read the theming tutorial:
    https://www.zenphoto.org/news/theming-tutorial/

    To achieve this you first need to create a custom index.php file of your theme.

    Then you have to manually set the album you want to display to "current" there. There is a function name makeAlbumCurrent() do to so. Then you need to add the next_image loop. Note I have never tried/tested this, this is how it theoretically might work.Also note that his has of course impact on the gallery in total as you will literally will "disable" all other top level albums by doing this.

    In any case the pagination will not work as expected as the the toplevel gallery URLs are pathtoyourinsall/page/1 and those of an album are pathtoyourinstall/albumname/page/1. So all further pages will change to that album based URL. That is how Zenphoto works.

  • While what you want to do is achievable with Zenphoto it is a seriously complicated change. There are the pagination issues that Acrylin mentions above, but there are also other issues with links. For instance, when you are viewing an image there is a link to take you back to the album that contains the image. Obviously without some change to the image.php script that link will not take you back to the index page.

    To make the changes needed you will need more than a working knowledge of PHP. You will also have to have a pretty complete understanding of how the Zenphoto architecture deals with albums and images.

    If all you want is software to display a simple set of images, maybe Zenphoto is overkill.

  • I'd like to achieve exactly the same thing. I'm using ZenPhoto to build my photography site and just have one main album. I may have other albums in the future, but that is not my immediate intention. What I want is a general photography site with info and links and a small album of images which load on the front page.

    I was thinking of using an Apache mod_rewrite rule so that access to index.php was redirected to index.php?album=Sample-Images but I'm not sure this approach will work. Does anyone have any experience here?

    There has to be an easy way to make this work, no?

    http://photography.woodspiral.co.uk/index.php?album=Sample-Images

    Thanks,
    David.

  • acrylian Administrator, Developer

    There has to be an easy way to make this work, no?

    As explained no. You can of course do a redirect but pay atention to do that right regarding SEO. That would at least workaround any pagination etc issues as you end up on the real album page.

    Alternatively you can quite easily print the latest x images of one album on the home page by using the image_album_statistics plugin. See the in file documentation of it how to use it by modifying your theme. Of course it is a good idea to read the theming tutorial first.

  • Thanks, Acrylian. I get a 404 error accessing the documentation for image_album_statistics:

    https://docs.zenphoto.org/package-plugins.image.album.statistics.html

  • acrylian Administrator, Developer
    edited May 2020

    You should not get such a link on the backend anymore (and I confirmed that 1.5.6 does not provide this.)
    It is not possible to group functions by plugin package with the doc generator anymore. You have to open the plugin file itself and review the file itself. The doc for the functions itself is available directly though: https://docs.zenphoto.org/1.5.3/function-printImageStatistic.html

    Edit: I see, our site still generates that old link. That's a bug.

Sign In or Register to comment.