Field Label values

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 12, 2011   (RSS)

By rcrofoot - April 12, 2011

Hello-

I'm trying to display a regular old Field Label value, but all I seem to be able to access is the table fieldname value...Here's what I have:

<?php $count=0; ?>
<?php foreach ($record['presentations'] as $upload): ?>
<?php if (!$count)
{
echo $upload['fieldName'].":<br/>";
}
$count++; ?>...etc...

The above code displays "presentations" which is the table fieldname...I'm trying to get the label of the field which is "Presentation Templates"...

I tried echo $upload['fieldLabel'], but no luck...

Can you tell me how retrieve the actual label value of a field...and not the table fieldname...

Many thanks, Rick

Re: [rcrofoot] Field Label values

By Jason - April 12, 2011

Hi Rick,

Just to clarify, in your section you have an upload field called presentations which has a field label of "Presentation Templates". When outputting these records, you want to output "Presentation Templates:" before outputting the first one. Is that right?

If so, there is no simple way of accomplishing this, since field labels are not actually stored in the database. All of the records you have in $record['presentations'] is actually coming from the uploads table, not the same table that your field is in.

There are a couple of options for you to get around this:

1) Since we know all of these uploads are coming from the same field and will therefore have the same field label, we can just hard code in that value.
echo "Presentation Templates: <br/>";

2) The other option would be to add "Presentation Templates" to the "Title" of each upload. You can then output that value through code using the "info1" field like this:
echo $upload['info1']. ":<br/>";

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/