电话
13363039260
内容详情中(show.html) 模板中调用方法是:
默认class写法:{dr_get_ftable(字段ID号, $字段名)}
自定义table的class写法:{dr_get_ftable(字段ID号, $字段名, 'mytableclass')}
mytableclass就是给表格加class,解析为:table calss="mytableclass"
----------------按需输出列表的写法0------------
{php $field = \Phpcmf\Service::C()->get_cache('table-field', 这里填写Ftable字段的id号); $value = dr_string2array($字段名); }
<table>
<thead>
<tr>
{if ($field['setting']['option']['is_first_hang'] && !$field['setting']['option']['is_add'])}
<th> {dr_lang($field['setting']['option']['first_cname'])} </th>
{/if}
{loop $field['setting']['option']['field'] $t}
{if $t['type']}
<th {if $t['width']}style="width:{php echo is_numeric($t['width']) ? $t['width'].'px' : $t['width'];};"{/if}> {dr_lang($t['name'])}</th>
{/if}
{/loop}
</tr>
</thead>
<tbody>
{php $i = 1;}
{loop $value $ii $val}
<tr>
{if ($field['setting']['option']['is_first_hang'] && !$field['setting']['option']['is_add'])}
<td> {dr_lang($field['setting']['option']['hang'][$i]['name'])} </td>
{/if}
{loop $field['setting']['option']['field'] $n $t}
{if $t['type']}
<td>{$val[$n]}</td>
{/if}
{/loop}
</tr>
{php $i++;}
{/loop}
</tbody>
</table>
注意:
1、[字段名]需要换成你定义的具体字段英文名称
2、如果在list循环中调用,需要把[字段名]改成[$t.字段名]