静态网页制作——在admin显示留言信息列表(没有样式)

这篇博客介绍了如何在admin界面中不使用样式地显示留言信息列表,详细讲解了如何将数据库中的每个字段逐一呈现。
1.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\controller
创建Message.php文件
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\controller\Message.php
CTRL+R 全部替换
<?php
namespace app\admin\controller;
use think\Controller;
class Message extends Controller
{
    public function lst() // 加载管理员列表
    {
        $messageres=\think\Db::name('message')->paginate(3);
        $this->assign('messageres',$messageres);
//        dump($list);
        return $this->fetch();
    }
}
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view
创建"Message"文件夹
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Admin
中的lst.html文件复制到\admin\view\Admin文件下

 

2.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
{volist name="list" id="vo"}  修改为:{volist name="messageres" id="vo"} 
{$list->render()}   修改为:{$messageres->render()}  

3.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
修改为:
 <thead class="">
                            <tr>
                                <th class="text-center" width="5%">ID</th>
                                <th class="text-center">管理员名称</th>
                                <th class="text-center" width="14%">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                             {volist name="messageres" id="vo"}
                                <tr>
                                <td align="center">{$vo.id}</td>
                                    <td title="{$vo.name}"><a target="_blank" href="#" title="{$vo.name}">{$vo.name}</a>
                                    </td>

显示出admin——>message——>lst.html中的name信息!
http://www.iheyu.com/owz/public/index.php/admin/message/lst.html
4.把其它的信息也显示出来:
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
修改信息:
  <tr>
                                <th class="text-center" width="5%">ID</th>
                                <th class="text-center">管理员名称</th>
                                <th class="text-center" width="14%">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                             {volist name="messageres" id="vo"}
                                <tr>
                                <td align="center">{$vo.id}</td>
                                <td title="{$vo.name}"><a target="_blank" href="#" title="{$vo.name}">{$vo.name}</a></td>
                                <td title="{$vo.telephone}"><a target="_blank" href="#" title="{$vo.telephone}">{$vo.telephone}</a></td>
                                <td title="{$vo.address}"><a target="_blank" href="#" title="{$vo.address}">{$vo.address}</a></td>
                                <td title="{$vo.email}"><a target="_blank" href="#" title="{$vo.email}">{$vo.email}</a></td>
                                <td title="{$vo.content}"><a target="_blank" href="#" title="{$vo.content}">{$vo.content}</a></td>
http://www.iheyu.com/owz/public/index.php/admin/message/lst.html

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值