Check out the latest documentation.

Accessing Metadata - Version 3

The file 51Degrees_metadata.php provides meta data associated with the properties and values available in the dataset. Meta data can be used in user interface components to enable end users to easily understand the data they're working with. For example: Content Management Systems (CMS) can provide drop down lists of possible properties and values to create rules to determine which theme or skin should be used.

The global variable $_51d_meta_data, created by 51Degrees_metadata.php, provides an array of meta data. The property name is the array key.

The following table describes the $_51d_meta_data array and the information available.

Field Description
Description Text description of the property and how it should be used.
URL Hyperlink to more information about the property, if available.
List True to indicate that the property can have more than one value and an array of values will be returned. False to indicate a single value will be returned.
Values Array of all possible values for the property. Key field is value name. i.e. 'Apple', 'Sony', 'HTC'.
ValueType The type of the property. Could be 'string', 'integer', 'double', 'boolean' or 'javascript'.

The following table describes the array returned by the Values element of the property array.

Field Description
Description Text description of the value and how it should be used.
URL Hyperlink to more information about the value, if available.

The following example code shows how to access information related to the LayoutEngine property.

										
										<?php
										
										
										
										
										require_once
										
										
										
										
										'path/to
										
										
											
											/core/51Degrees_metadata.
											
										
										
										php'
										
										
										;
										
									
										
										?>
										
									
<!doctype html>
<html>
  <head></head>
  <body>
  <table>
    <tr>
      <th colspan="2">Layout Engine<th>
    </tr>
    <tr>
      <td>Description</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'Description'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <td>List</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'List'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <td>URL</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'URL'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <th colspan="2">Possible Values</th>
  </tr>
  
										
										<?php
										
										
										foreach
										
									 (
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'Values'
										
									] 
										
										as
										
										
										$key
										
										
										=>
										
										
										$value
										
									) {
      
										
										echo
										
										
										'<tr><td>'
										
										
										.
										
										
										$key
										
										
										.
										
										
										'</td><td>'
										
										
										.
										
										
										$value
										
									[
										
										'Description'
										
									]
										
										.
										
										
										'</td></tr>'
										
									;
    }
  
										
										?>
										
									
  </table>
  </body>
</html>

									

The meta data include should only be added to pages that require meta data and is entirely optional.

Accessing Metadata - Version 2

The file 51Degrees.mobi.metadata.php provides meta data associated with the properties and values available in the dataset. Meta data can be used in user interface components to enable end users to easily understand the data they're working with. For example; Content Management Systems (CMS) can provide drop down lists of possible properties and values to create rules to determine which theme or skin should be used.

The global variable $_51d_meta_data, created by 51Degrees.mobi.metadata.php, provides an array of meta data. The property name is the array key.

The following table describes the $_51d_meta_data array and the information available.

Field Description
Description Text description of the property and how it should be used.
URL Hyperlink to more information about the property if available.
List True to indicate that the property can have more than one value and an array of values will be returned. False to indicate a single value will be returned.
Values Array of all possible values for the property. Key field is value name. i.e. True or False.

The following table describes the array returned by the Values element of the property array.

Field Description
Description Text description of the value and how it should be used.
URL Hyperlink to more information about the value if available.

The following example code shows how to access information related to the LayoutEngine property.

										
										<?php
										
										
										require_once
										
									(
										
										'51Degrees-Premium/51Degrees.mobi.metadata.php'
										
									);

										
										?>
										
									
<!doctype html>
<html>
  <head></head>
  <body>
  <table>
    <tr>
      <th colspan="2">Layout Engine<th>
    </tr>
    <tr>
      <td>Description</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'Description'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <td>List</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'List'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <td>URL</td>
    <td>
      
										
										<?php
										
										
										echo
										
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'URL'
										
									];
      
										
										?>
										
									
    </td>
  </tr>
  <tr>
    <th colspan="2">Possible Values</th>
  </tr>
  
										
										<?php
										
										
										foreach
										
									 (
										
										$_51d_meta_data
										
									[
										
										'LayoutEngine'
										
									][
										
										'Values'
										
									] 
										
										as
										
										
										$key
										
										
										=>
										
										
										$value
										
									) {
      
										
										echo
										
										
										'<tr><td>'
										
										
										.
										
										
										$key
										
										
										.
										
										
										'</td><td>'
										
										
										.
										
										
										$value
										
									[
										
										'Description'
										
									]
										
										.
										
										
										'</td></tr>'
										
									;
    }
  
										
										?>
										
									
  </table>
  </body>
</html>

									

The meta data include should only be added to pages that require meta data and is entirely optional.