The Problem is that some time ago I somehow managed to output the content of a Structure as a Object (via var_dump).
I noticed that the Value of this Object is what I was looking for and I had to check for
The result of me checking that Object for a value is below.
It is indeed… The really weird thing is that I know that somehow I managed to output it 2 weeks ago somehow.
But i’ve been strugeling for some time now to perform the same.
Well, the code I posted above I have used a hundred times and I don’t really understand why your server should run into a memory issue with only two entries.
Please check the memory_limit setting in your php.ini, maybe it is ridiculously low…
Thanks! Deleting everything else helped. But I will get a object that includes the WHOLE Page not just the “leistungusp” structure is it supossed to be like that?
The output I want to recreate is pretty much something like this (not accurate representation):
Object
(
[page] => technische-sauberkeit
[text] => Sample text one
[value] =>
)
This is what a var_dump() returns in a Starterkit (limited to two entries):
object(Structure)[115]
public 0 =>
object(Structure)[131]
public 'title' =>
object(Field)[132]
public 'page' => string 'contact' (length=7)
public 'key' => string 'title' (length=5)
public 'value' => string 'Contact' (length=7)
public 'text' =>
object(Field)[133]
public 'page' => string 'contact' (length=7)
public 'key' => string 'text' (length=4)
public 'value' => string 'Feel free to drop us a line if you have any questions.' (length=54)
public 'url' =>
object(Field)[134]
public 'page' => string 'contact' (length=7)
public 'key' => string 'url' (length=3)
public 'value' => string 'mailto:support@getkirby.com' (length=27)
public 'linktext' =>
object(Field)[135]
public 'page' => string 'contact' (length=7)
public 'key' => string 'linktext' (length=8)
public 'value' => string 'Write an email' (length=14)
public 'icon' =>
object(Field)[136]
public 'page' => string 'contact' (length=7)
public 'key' => string 'icon' (length=4)
public 'value' => string 'contact.svg' (length=11)
public 1 =>
object(Structure)[137]
public 'title' =>
object(Field)[138]
public 'page' => string 'contact' (length=7)
public 'key' => string 'title' (length=5)
public 'value' => string 'Forum' (length=5)
public 'text' =>
object(Field)[139]
public 'page' => string 'contact' (length=7)
public 'key' => string 'text' (length=4)
public 'value' => string 'Join the Kirby community and connect with others.' (length=49)
public 'url' =>
object(Field)[140]
public 'page' => string 'contact' (length=7)
public 'key' => string 'url' (length=3)
public 'value' => string 'https://forum.getkirby.com/' (length=27)
public 'linktext' =>
object(Field)[141]
public 'page' => string 'contact' (length=7)
public 'key' => string 'linktext' (length=8)
public 'value' => string 'Visit Kirby’s forum' (length=21)
public 'icon' =>
object(Field)[142]
public 'page' => string 'contact' (length=7)
public 'key' => string 'icon' (length=4)
public 'value' => string 'forum.svg' (length=9)
But this has 5 fields… If you use dump() instead of var_dump() you get some cleaner output.
Now that I think about it, you are then probably on a PHP version below 5.6… if you update, you will get more concise output.
Kirby objects such as $page, $site or $file have a lot of connections to other objects. The result is that a lot of stuff is printed when debugging those objects with var_dump(), print_r() or dump().
Starting with Kirby 2.4, the most complex objects are now printed with their most important information only. Please note that this new feature only works with PHP 5.6 or later. https://getkirby.com/changelog/kirby-2-4-0
What is weird that I did manage to output just that object 2 weeks ago. Maybe the system Admin did a test for > PHP 5.6 for a short time but i highly doubt it…
Yes we currently are preparing for the update to PHP7.
So that will happen anyway, i just found it weird, that somehow this worked for me some time back. But I’ll just leave it as it is for now.