shadowhung 发表于 2010-11-4 21:08:14

新手求助

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几天时间。。

jeongee 发表于 2010-11-4 21:19:59

url传参啊,然后数据库读出文章然后显示

shadowhung 发表于 2010-11-4 21:55:28

url传参...

额~~ 能稍微说具体一点点吗 :dizzy:

visvoy 发表于 2010-11-8 08:30:19

就是用<a href="xxx">xxx</a>或者anchor()之类的,楼主多看看ci手册和html手册吧
页: [1]
查看完整版本: 新手求助