Label on page list
Yes, if you want to get the field labels as they appear in the CMS, you need to load in information from the schema. To do this you can use the getSchemaFields() function. You pass into this the tableName of the section you want to load. This function returns an multi-dimensional array where the name of the field (ie, num) is the index. Inside each field in the array, there is a field called "label" with the actual field label (ie, "Record Number")
So, if you wanted to output every field name and label in a section, you could do it like this:
<?php $schemaFields = getSchemaFields("news"); ?>
<?php foreach ($schemaFields as $fieldName => $fieldInfo): ?>
<p>Field Name: <?php echo $fieldName;?></p>
<p>Field Label: <?php echo $fieldInfo['label'];?></p>
<?php endforeach ?>
Hope this helps.
Jason Sauchuk - Project Manager
Hire me! Save time by getting our experts to help with your project.