Problem to get structurefield to work in the Panel

Hi,
I’m a little bit confused using structure fields. I don’t get it work properly.
I have an blueprintfile partner.php

title: Page
pages: true
files: true
fields:
	title:
		label: Title
		type:  text
	textbeforpartner:
		label: Text über Partnerauflistung
		type: textarea
	size: large
	icon: align-left
addresses:
	label: Adressen
	type: structure
	entry: >
      {{street}}<br />
      {{zip}} {{city}}
    fields:
		street:
			label: Street
			type: text
		zip:
			label: ZIP
			type: text
		city:
			label: City
			type: text

It contented actually the example from the documentation.

Here you can see what I get at the panel, no fields. What do I wrong?

Cheers

I assume there’s something wrong with your indentation. Can’t really tell from what you posted above, but if I copy and paste the above code into a text editor, it is wrong.

Hi,
what is wrong in your texteditor?
Here in the editor it changed the indentation.
I copied it direct from the Kirby documentation and changed the spaces into tabs. And yet this worked proper until the structurefield.

It looks alright, but all I can tell you is that the missing fields are a typical sign of incorrect indentation within the structure field. With correct indentation, the blueprint works perfectly, see screenshot of what it should look like in your editor.

1 Like

Hey,
thank you very much for you tip with the wrong indentation.
I set the invisible characters on and see that before fields where four spaces.
Also I have mixed the indentation.

Glad you sorted it out :grinning: Whenever you have a problem with blueprints, check for

  • correct indentation
  • correct field names
  • matching file names

Hints to all:

  • I never use tabs, I always use two spaces for indentation
  • I always use Notepad++ (on windows surely), it changes all tabs to two spaces each, I always set the invisible characters on, it writes UTF-8 and linux/unix line endings (on windows!)

Hints to all:

  • I avoid capital letters in all file names

I know, this is no necessity (e.g. on windows), but it avoids errors on other webservers :wink:

[Added:]
@bastianallgeier:
I hereby propose that such hints (like these from @texnixe) should be included in the documentation of Kirby. It is not the first time that these are a problem for a newer user/developer using Kirby.

Hi Heiner,

but spaces are not tabs. On a semantik way tabs doing other than spaces and I think it should do it also on programming.
To use spaces to prevent mistakes are the wrong way. To it right and you have no problems!
And always use Notepad is also no a possible way to prevent mistakes. First as a kill argument I work on OSX ;).
Also to set always invisible characters to show is not a way for me because I think it makes the source code bad to read.

I think it is better to learn to do no mistakes or if something is wrong, know where the mistakes can be.

But I think standard mistakes to include in the documentation is a good way to prevent and help beginners.

I have never had problems with tabs in my blueprint yaml files (rather sometimes with spaces), but in fact, the yaml specs do not allow tabs but only spaces, due to the fact that tabs are handled differently by different systems.

However, the number of spaces is irrelevant as long as all sibling nodes use the same amount of indentation.

http://www.yaml.org/spec/1.2/spec.html#id2777534

The important thing here is to know where to look for errors, not which editor you use.