Skip to main content

Displaying custom field values in any page

This is really simple by calling a single function passing the custom field ID, project or user ID and the type.

How to use this function?

For Project:

To show a custom field value for project, simply add two lines of code.

  • <?php 
    echo FieldsHelper::getFieldValue(12, $row->id, 'project');
    ?>

    In the above code, first parameter is the custom field ID, second parameter is the project ID and thrid parameter is the type. For projects, type is 'project'

  • <?php 
    $fields = JblanceHelper::get('helper.fields');
    echo $fields->getFieldValue(12, $row->id, 'project');
    ?>

    In the above code, line 1 creates and instance of the class and should not be changed.

    In the line 2, first parameter is the custom field ID, second parameter is the project ID and thrid parameter is the type. For projects, type is 'project'


 For Profile:

To show a custom field value for profile, simply add two lines of code.

  • <?php 
    echo FieldsHelper::getFieldValue(3, $row->id, 'profile');
    ?>

    In the above code, first parameter is the custom field ID, second parameter is the user ID and thrid parameter is the type. For user profiles, type is 'profile'

  • <?php 
    $fields = JblanceHelper::get('helper.fields');
    echo $fields->getFieldValue(3, $row->id, 'profile');
    ?>

    In the above code, line 1 creates and instance of the class and should not be changed.

    In the above code, first parameter is the custom field ID, second parameter is the user ID and thrid parameter is the type. For user profiles, type is 'profile'