【发布时间】:2014-01-12 01:29:07
【问题描述】:
我在我的 Joomla 网络应用程序中添加了以下 PHP 代码。 这将创建一个用户组中所有用户的表。
我怎样才能使这个表可排序?
是否有一些 Joomla/PHP 代码或插件可以按名称排序此列表? 我可以添加一个参数来按任何列排序吗?
<?php
$teachers = JAccess::getUsersByGroup(10); //change number in the brackets
echo "<table class=\"table table-striped\">";
echo "<thead>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Street</th>";
echo "<th>Zip</th>";
echo "<th>City</th>";
echo "<th>Phone</th>";
echo "<th>Email</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
foreach($teachers as $user_id) {
$user = JFactory::getUser($user_id);
$profile = JUserHelper::getProfile($user->id);
echo "<tr>";
echo "<td>".$user->name."</td>";
echo "<td>".$profile->profile['address1']."</td>";
echo "<td>".$profile->profile['postal_code']."</td>";
echo "<td>".$profile->profile['city']."</td>";
echo "<td>".$profile->profile['phone']."</td>";
echo "<td>".$user->email."</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>
【问题讨论】:
标签: php sorting joomla html-table jquery-ui-sortable