Hi everyone,
I am new to ProcessWire and have an question about the methods get field values.
First of all my page setup:
I have a page as a child of the Admin page which is named Data. The idea is to create all my data objects as children of this page. So the data page and all of its children should never be seen on the front-end. Every page uses the same template. The template has one field named playername of type Text.
Now I am looping through all pages which are children of the Data page in this way (The page id is 1011):
//get the data-page
$datapage = $pages->get(1011);
//get all children from data-page
$players = $datapage->children();
//loop through the children
foreach($players as $player) {
$field = $player->fields->get("playername");
echo $player->title . " " . $field . "<br> ";
}
The problem now is, that I don't get the value of the field playername. Instead the output of $field is "playername". Why am I getting the field name instead of the fieldvalue. I am expecting to get the string, which is entered in the playername-field and not the name.
Hope anybody can help me and big thanks in advance!