I’m very excited about simplictiy of Kirby and I think the concept behind it is very smart.
I’m testing if it fits our needs.
We have a table of data (just text and numbers).
To edit the data the most simple way would be to just click into a field of the table and change its value.
Is this possible via a blueprint in the panel?
I did not find anything about it in the documentation.
However, it doesn’t allow clicking into a cell to edit it, but you have to edit rows of data.
The Editor plugin comes with a table block as an add-on (in the examples folder), but I wouldn’t recommend using this block plugin at the moment, because the Editor is undergoing massive changes at the moment.
My personal preference is with the Structure field as well (editing rows of data suited my needs rather well so far), but you may want to peek at the Table field plugin – I have not yet used it myself, though, so can’t share any hands-on experience with it.
But I get lost at the point where storing data in YAML format is descripted.
To me it’s not clear where the YAML has to be stored and how it has to be written.
Let’s say I have it in /content/projects/datalist.yml
It contains the exampledata:
Monaco:
Street: Rue de WTF 17
ZIP: 1112
City: Monaco
Phone: 555-1234
Email: me@monaco.org
NewYork:
Street: 1212 Broadway
ZIP: 4321
City: New York
Phone: 666-4321
Email: me@ny.org
Bahamas:
Street: At the beach
ZIP: 9999
City: The capitol of the Bahamas
Phone: 777-9999
Email: me@bahamas.org
But the dumb results always empty.
What do I do wrong?
Edit:
I got it:
The YAML file with the backend structure (like all YAML files?) has to be stored in /blueprints/pages.
The data has to be stored in /content/projects/projects.txt
Ts ts, typical newbie question
A structure is a field, and all fields are saved to a “page” (which is a “template.txt” file in /content/projects/. (If your template is named project, the file should be named project.txt)
Imho for first time experience with structures it’s best to setup a blueprint for your project page that contains a structure field e.g. addresses. Add the needed fields (street, zip, city, phone, email) to that structure, login to the panel, create a new project page, add a few records and see how it’s stored in the txt file.
You can use your addresses list in a project template you can use var_dump($page->addresses->toStructure()); to visualize the collection of addresses for you to work with.
Starter blueprint:
title: project
preset: page
fields:
title:
label: Page title
type: text
addresses:
label: Addresses
type: structure
fields:
street:
label: Street
type: text
zip:
label: ZIP
type: text
city:
label: City
type: text