1-L-P
February 6, 2021, 2:43am
1
Hello all, would anyone know I might show images from a page subfolder in the panel?
In my YML file:
sections:
gallery:
type: posters/files
layout: cards
image:
cover: true
ratio: 4/3
brings up images in that are in the parent page folder, I have a subfolder within this which I would also like to show in the panel? Thanks all.
A files section can only have one parent page, you cannot query images from multiple pages.
If you only need display functionality without the upload option, you can use my plugin that allows querying files:
As an alternative, you can use multiple sections with different parent pages.
1 Like
hww
February 6, 2021, 9:21am
3
This is exactly what I need right now. Thanks alot, @texnixe !
1-L-P
February 6, 2021, 10:35am
4
@texnixe I thought this might be the case, however, your plugin might be a good workaround, will check it out! Thanks
Dear @texnixe ,
you said that…
A files section can only have one parent page, you cannot query images from multiple pages.
I have a follow-up question about this: Is it possible to query files from a single subpage?
I have the following use case: My “home” page shall have two image sliders. Thats why I have put the images into two seperate subfolders e.g. “home/carousel” and “home/gallery”. At first I was optimistic that I could create two sections in the panel to display the respective images with the query option. For the example of the “carousel”, I tried the following queries. Unfortunately, the panel only shows me the pictures of the “Home” father page.
query: page.children.find('carousel').images
query: site.find('home').children.find('carousel').children.images
query: site.find('home').children.find('carousel').images
query: site.find('home').children.images
query: page.children.images
In the template, I am able to retreive the carousel-images in the following way:
<?php $images = $page->children()->find('carousel')->images() ?>
Thanks in advance
Alexander
It seems that I was on the wrong track. I am now able to list the images of my subfolder “carousel” by using the “parent ” option.
parent: page.find("carousel")
Nice plugin. The composer doesn’t seems to work anymore. But still available via download.
Another question: How can you get files form site and all (sub)pages in one query?
site.index.files
site.files
texnixe
November 12, 2022, 11:25am
8
site.files.add(site.index.files)
If that doesn’t do the job, create a custom site method.
Thanks for letting me know, will look into it when I find the time.
That’s does the job:
site.files.add(site.index.files)
Thanks for your input, Sonja.
texnixe
November 12, 2022, 2:58pm
10
Oh dear, yes, corrected above…