typecho输出所有用户的信息
作者:佚名 来源:爱好者 时间:2017-02-26
在某个页面输出所有用户的信息,如上图效果
方法入下,在独立页面模板中加入以下代码
<table class="typecho-list-table">
<colgroup>
<col width="20"/>
<col width="6%"/>
<col width="30%"/>
<col width=""/>
<col width="25%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr>
<th><?php _e('用户名'); ?></th>
<th><?php _e('昵称'); ?></th>
<th><?php _e('电子邮件'); ?></th>
<th><?php _e('用户组'); ?></th>
</tr>
</thead>
<tbody>
<?php Typecho_Widget::widget('Widget_Users_Admin')->to($users); ?>
<?php while($users->next()): ?>
<tr id="user-<?php $users->uid(); ?>">
<td><?php $users->name(); ?>
</td>
<td><?php $users->screenName(); ?></td>
<td><?php if($users->mail): ?><a href="mailto:<?php $users->mail(); ?>"><?php $users->mail(); ?></a><?php else: _e('暂无'); endif; ?></td>
<td><?php switch ($users->group) {
case 'administrator':
_e('管理员');
break;
case 'editor':
_e('编辑');
break;
case 'contributor':
_e('贡献者');
break;
case 'subscriber':
_e('关注者');
break;
case 'visitor':
_e('访问者');
break;
default:
break;
} ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table><!-- end .typecho-list-table -->
注:上述代码中除了php外,都可根据个人需求自行进行修改。
方法入下,在独立页面模板中加入以下代码
<table class="typecho-list-table">
<colgroup>
<col width="20"/>
<col width="6%"/>
<col width="30%"/>
<col width=""/>
<col width="25%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr>
<th><?php _e('用户名'); ?></th>
<th><?php _e('昵称'); ?></th>
<th><?php _e('电子邮件'); ?></th>
<th><?php _e('用户组'); ?></th>
</tr>
</thead>
<tbody>
<?php Typecho_Widget::widget('Widget_Users_Admin')->to($users); ?>
<?php while($users->next()): ?>
<tr id="user-<?php $users->uid(); ?>">
<td><?php $users->name(); ?>
</td>
<td><?php $users->screenName(); ?></td>
<td><?php if($users->mail): ?><a href="mailto:<?php $users->mail(); ?>"><?php $users->mail(); ?></a><?php else: _e('暂无'); endif; ?></td>
<td><?php switch ($users->group) {
case 'administrator':
_e('管理员');
break;
case 'editor':
_e('编辑');
break;
case 'contributor':
_e('贡献者');
break;
case 'subscriber':
_e('关注者');
break;
case 'visitor':
_e('访问者');
break;
default:
break;
} ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table><!-- end .typecho-list-table -->
注:上述代码中除了php外,都可根据个人需求自行进行修改。
- 上一篇:Yodu模板完全使用攻略
- 下一篇:typecho多说评论导入后评论数量不对怎么办