cmf已上线网站,利用more增加扩展参数

以官方后台模板admin_simpleboot3为例。

修改文章添加页面

文件地址:../public/themes/admin_simpleboot3/portal/admin_article/add.html

在需要的位置添加input

<th>演示地址</th>
  <td>
    <input class="form-control" type="text" name="post[more][theme_demo]" value="" placeholder="请输入模板演示地址"></td>
</tr>

*注意name元素中post[more][theme_demo]

修改文章编辑页面

这里要注意的一点是,因为之前发布的文章数据表里面是没有你新建的theme_demo参数的。

如果直接用在编辑早期文章的时候报错,所以这里需要添加if判断。

<if condition="!empty($post.more.theme_demo)">
  <tr>
    <th>演示地址</th>
    <td>
      <input class="form-control" type="text" name="post[more][theme_demo]" value="{$post['more']['theme_demo']}" placeholder="请输入模板演示地址">
    </td>
  </tr>
<else/>
  <th>演示地址</th>
  <td>
    <input class="form-control" type="text" name="post[more][theme_demo]" value="" placeholder="请输入模板演示地址">
  </td>
</if>

接下来就可以去后台测试发布文章了。

Comments 0

0.167886s