Image from fileset with a link

Permalink
Hello people,

I got this situation that I'm building a simple site for a customer. The site is mainly all about image galleries. What I'm suppose to do is to create a page (called Portfolio) that has links to different galleries. I have done few filesets already with pics inside of em. I have also done pages for those galleries. Let's call them gallery1 and gallery2. So gallery1 and gallery2 are subpages of portfolio page. Inside gallery1 and gallery2 pages I'm using Sortable Fancybox Gallery 1.14 addon which is pretty cool btw :)

Anyway, I added autonav to the portfolio page and configured it so it shows only sub pages of the portfolio. So basically that's what I was supposed to do but I would like to change it so that instead of a links (text) it would show a thumbnail of a first picture of every fileset. You still with me?

So basically I would like to loop trough all filesets and pick up a first image of every of them. Then I would like to show every picture on a screen (maybe little description also) and it should also have a link to a particular page. I named my pages after filesets so as long as I'm able to get a fileset's name I'm able to link it, true?

I don't know if I'm making things too complicated. Is there any ready made solution for this or should I start to study block writing :D Thank you for your answers anyway. I'm sorry I can't show my page for you. I'm developing it on localhost and I don't have an access to a server yet :)

 
jordanlev replied on at Permalink Reply
jordanlev
Howdy.
What you're trying to do is a bit on the complicated side, because you need to get the pages, then within each page you need to get the content, then within each page's content you need to get the selected fileset.

I think an easier way to do this is to create a page attribute where you put the image you want to display on the top-level page, then make a custom template for the Page List block that displays this image attribute. Unfortunately it means you're duplicating effort on the content entry side because someone has to choose a fileset for the gallery and choose the image for the page index -- and if you change the gallery it won't automatically update the index image attribute. But this is probably better than spending countless hours programming in exactly what you've described.

To do this, follow these steps:
1) Create the page attribute by going to Dashboard -> Pages and Themes -> Attributes, add a new attribute of the "File/Image" type.
2) Create a custom template for the Page List block by creating this new directory on your server: SITEROOT/blocks/page_list/templates
3) Download this file (do a "Save As" from your browser):https://raw.github.com/jordanlev/c5_clean_block_templates/master/pag...
4) Change the name of that file to something like "gallery_images.php" and then move it into the new directory you created in step 3.
5) Edit that file, and read the instructions in it under the "HOW TO USE IMAGE ATTRIBUTES" for how to include images in the page list.

Note that this requires good knowledge of HTML/CSS, and a tiny bit of PHP knowledge. If you aren't a designer or programmer at all, there are some page list templates available in the marketplace I believe that do this already (but they probably cost a little money and I'm not sure how easy they are to customize).

Good luck!