2017-02-07, 06:13:24
(2017-02-07, 05:16:52)Bigin Wrote: strange, have you tried my snippet, same result?
look at the "/data/imanager/fields/*.im.fields.xml" file, is there the order correct?
Show me your original code snippet for output pls
same result with your code.
actually fields are displayed in ID's order and not Position's order.
Code:
<?php
// this lines should always be above the rest.
if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
if(!isset($_SESSION)){session_start();}
$userid = (!empty($_SESSION['userid']) ? (int) $_SESSION['userid'] : false);
if (!$userid) {
header('Location: http://xxxxxxxx.org/login/');
exit;
}
$imanager = imanager();
$user = $imanager->getItem('slug=Users', $userid );
?>
Code:
<table class="invoices">
<?php
foreach ($user->fields as $data) {
if (isset($data->value)) {
echo '
<tr>
<th>' . $data->label . '</th>
<td>' . $data->value . '</td>
</tr>
';
}
}
?>
</table>