Discuz!开发之后台表格table自动生成函数介绍

来源:互联网 发布:网络电视剧排行榜2016 编辑:程序博客网 时间:2024/05/01 04:45

这里重点介绍三个与表格创建的相关函数:

一、showformfooter()创建表单尾

无返回值、无参数

用于接上showformheader()函数进行收尾工作

showtableheader()创建表格头

返回值:无

参数:

$title - 如果输入title则显示标题,class为header,否则仅显示一个table头

$classname - 定义此输出表格的CSS样式

$extra - 表格扩展属性

$titlespan - 表格列数

使用方法实例:

showtableheader('forums_edit_posts', 'nobottom');
二、showtablefooter()创建表格尾

用于接上showformheader()函数进行收尾工作

三、showtablerow()创建列表式页面的行

返回值:有

参数:

$trstyle - 此行 tr 标签的格式定义,如 class="partition"

$tdstyle <array> - TD 标签的格式定义,如 class,colspan 等

$tdtext <array> - TD内显示的内容

$return 是否返回值

此函数多用于循环中,用来逐行创建一个有规律的数据列表如:论坛版块列表等

使用方法举例 ./source/admincp/admincp_forums.php

showtablerow('', array('class="td25"', 'class="td28"'), array('<input type="checkbox" class="checkbox" name="delete[]" value="'.$mod[uid].'"'.($mod['inherited'] ? ' disabled' : '').' />','<input type="text" class="txt" name="displayordernew['.$mod[uid].']" value="'.$mod[displayorder].'" size="2" />',"<a href=\"".ADMINSCRIPT."?mod=forum&action=members&operation=group&uid=$mod[uid]\" target=\"_blank\">$mod[username]</a>",$modgroups[$mod['groupid']],cplang($mod['inherited'] ? 'yes' : 'no'),));

0 0