在 views 文件夹,咱们建立一个跟控制器名称同样的文件夹list,新建一个index.php的视图文件。php
咱们讨论过屡次,最后决定IBOS的视图机制仍是以高效为主。所以咱们没有使用模板,而是直接使用了原生的PHP。所以一个视图文件即是一个PHP文件。浏览器
为了演示方便,此次的视图使用了全局的layout,样式也是全局的。在大多数状况下应该能知足需求。固然你也能够设计模块独有的风格,使用模块独有的样式。app
注:全局的layout文件放在 system\theme\default\views\layouts\main.php。这个 layout 包含了头尾,中间的部分就是index.php 里的内容。ui
随后,咱们输入如下内容:this
index.php设计
<!-- Mainer --> <div class="mc clearfix"> <!-- Mainer right --> <div> <div class="page-list"> <div class="page-list-header"> <div class="btn-toolbar pull-left"> <div class="btn-group"> <a class="btn" <?php echo $this->createUrl( 'content/add' ); ?>>增长留言</a> <a class="btn" <?php echo $this->createUrl( 'content/del' ); ?>>删除留言</a> </div> </div> </div> <div class="page-list-mainer"> <?php if ( count( $list ) > 0 ): ?> <table class="table table-striped table-hover"> <thead> <tr> <th><label class="checkbox"><input type="checkbox" data-name="message"></label></th> <th>留言人</th> <th>时间</th> <th>内容</th> <th>操做</th> </tr> </thead> <tbody> <?php foreach ( $list as $index => $row ): ?> <tr> <td width="20"> <label class="checkbox"> <input type="checkbox" name="message" value="<?php echo $row['id']; ?>"> </label> </td> <td><?php ?></td> <td><?php echo ConvertUtil::formatDate( $row['time'], 'u' ); ?></td> <td><?php echo $row['content']; ?></td> <td> <?php if ( $row['uid'] == Ibos::app()->user->uid ): ?> <a class="btn btn-small" <?php echo $this->createUrl( 'content/del', array( 'id' => $row['id'] ) ); ?>>删除</a> <a class="btn btn-small" <?php echo $this->createUrl( 'content/edit', array( 'id' => $row['id'] ) ); ?>>编辑</a> <?php endif; ?> <a class="btn btn-small" <?php echo $this->createUrl( 'content/reply', array( 'id' => $row['id'] ) ); ?>>回复</a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="page-list-footer"> <div class="pull-right"> <?php $this->widget( 'IWPage', array( 'pages' => $pages ) ); ?> </div> </div> <?php else: ?> <div class="no-data-tip"></div> <?php endif; ?> </div> </div> </div>
这个视图里的逻辑应该不难理解。orm
咱们先跳过这个视图里出现的陌生的方法,打开浏览器,输入 {你的IBOS访问地址}/?r=messageboard/list/index,看看页面是否是出来了?blog
如今尚未任何内容,由于咱们还没写添加及其余的方法。可是到这里,已经没有什么难题了,你基本须要了解的已经了解了。ip