Many things become clear and easy to solve. But there are tasks that are baffling (while I have little knowledge)
I have a page with PDF files, the files are placed in sections using the Structure field
From the current page (panel) I select a specific section (loctype field)
and if it is selected I get the file name (filename)
fields:
loctype:
type: select
options:
management: Charter A
direction: Charter B
features: Charter C
management:
type: select
options: query
query:
fetch: site.find("svedeniya/dokumenty/lokalnye").management.toStructure()
text: "{{structureItem.locname}}"
value: "{{structureItem.locfile.tofile.filename}}"
when:
loctype: management
direction:
type: select
options: query
query:
fetch: site.find("svedeniya/dokumenty/lokalnye").direction.toStructure()
text: "{{structureItem.locname}}"
value: "{{structureItem.locfile.tofile.filename}}"
when:
loctype: direction
features:
type: select
options: query
query:
fetch: site.find("svedeniya/dokumenty/lokalnye").features.toStructure()
text: "{{structureItem.locname}}"
value: "{{structureItem.locfile.tofile.filename}}"
when:
loctype: features
I need this data to put it in the parameters of the called snippet <?php snippet('locfiles/lokalnye-row', ['section' => 'The resulting VALUE loctype', 'files' => ['The resulting VALUE filename']]); ?>
I will figure out the PHP code for substitution of values.
I cannot figure out the correct composition of the blueprint file.
Now I get these values in the txt file
You cannot change the structure of what the structure field stores in your content file.
But you can filter your structure field content, because the field value converted to a structure object is a collection and you can work with it. For example:
The problem is different. I coped with the output in the template via PHP.
All right. I can’t do it nicely in the admin panel. In principle, and now it all works, it’s just not beautiful like that.
The structure section in the pane displays empty columns, etc.
I need to select one, sometimes several files from each section.
I can now hard-code in the template the choice of which section and which file to call with the snippet parameters.
But I wanted to do it through the panel.
Well, when I created the topic I already understood that this was a technical task, and not a question.
I will postpone this problem for now. Over time, I’ll come up with something.
Apparently I made a mistake in the architecture of the page with PDF files.
It was necessary not to divide it into sections by structure fields.
A place all files in a single structure file, assigning each a category. It would be easier now. So I’ll redo the page with the PDF files.
I almost every page of the site need to access this page with PDF files extracting from it one, two, maybe several files.
This is like a database of document files, which, depending on the category, are placed on certain pages of the site.
Thank you again for your attention to our questions.
When you sit and think, you don’t always come to a decision.
And when you write a question on the forum, the process of typing begins to make sense.
It’s like saying the problem out loud.
The good thing is, that there are often many ways to achieve a thing. The hard thing is finding the right way to do something in a specific use case ;).
Section 1 (This is the title used from the select field in h3)
Table 1
The file that is assigned the value "Section 1" in the locpart field
The file that is assigned the value "Section 1" in the locpart field
The file that is assigned the value "Section 1" in the locpart field
etc..
Section 2 (This is the title used from the select field in h3)
Table 2
The file that is assigned the value "Section 2" in the locpart field
The file that is assigned the value "Section 2" in the locpart field
The file that is assigned the value "Section 2" in the locpart field
etc..
Etc..
Oh, ambush
My section names start with a number.
I can, of course, remove them, but this is a crutch.
The numbers are important there.
Good. I’ll think.