|
view层:
<?php foreach ($results->result() as $result):?>
<p>新闻ID:
<?php echo $result->message_id;?></p>
<p>新闻标题:<br />
<?php echo $result->message_title;?></p>
<p>新闻发布时间:<br />
<?php echo $result->message_time; ?></p>
<p>新闻发布作者:<br />
<?php echo $result->message_user; ?></p>
<?php endforeach; ?>
</form>
<?php echo $this->pagination->create_links(); ?>
control层
$this->load->library('pagination');
$this->load->database();
$config['base_url'] = base_url().'index.php/listing/index';
$config['total_rows'] = $this->db->count_all('message');
$config['per_page'] = '2';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
//load the model and get results
$this->load->model('messageModel');
$data['results'] = $this->messageModel->list_mess($config['per_page'],$this->uri->segment(3));
// load the view
$this->load->view('list_view', $data);
我只是foreach 出了文章表的ID、标题、时间、作者
我想可以点击标题进入到文章的内容页面
该从哪里去着手?
本人才刚学CI几天时间。。 |
|