ビューを呼び出す特定のリンクを持つページがあります。ビューがコントローラにcoresponding機能が実行された後に表示される ページのHTMLは、コントローラが含まビューコントロールのhrefの問題
<a href="xxxxxxx">Click to view</a>
次の行が含ま
public function get_comments()
{
if(!file_exists('application/views/blog/list_comment_view.php'))
{
show_404();
}
else
{
$row_nums=$this->blog->get_row_nums();
$config['base_url']=base_url().'index.php/blog/list_comment_view';
$config['total_rows']=$row_nums;
$config['per_page']=5;
$config['num_links']=2;
$config['full_tag_open']='<p>';
$config['full_tag_close']='<p>';
$config['first_link']='First';
$config['last_link']='Last';
$this->pagination->initialize($config);
$data['comments']=$this->blog->get_comments($config['per_page'],$this->uri->segment(3));
$this->load->library('table');
$this->table->set_heading('No','Title','Created','Modified','Action');
$this->load->view('blog/list_comment_view', $data);
}
}
list_view.phpは
<body>
<div>Welcome ,
<?php
$array=$this->session->userdata('db_result');
echo $array[0]['name'];
?></div>
<?php
$this->table->generate($comments);
$this->pagination->create_links();
?>
</body>
あります私は直接そこに "get_comments"を置くので、私はXXXXXXを置き換えるべきであることを知りたいですが、それはlist_view.phpを表示するのに失敗します。 list_view.phpの値$ commentsはサイズがゼロであるため、何も表示されていません。
ごめんなさい、実際には、うまく動作します。私はgenerate($ comments)を "エコー"することを忘れています。 (自動ロード)をロードした場合
$this->load->helper('url');
による読み取りのために、あまりにもあなたの懸念の:-Dみんなありがとう..
私はcodeigniterは分かりませんが、推測しなければならない場合は、URLにページ単位の数を指定する必要があるように見えます。したがって、 'href'は'/index.php/blog/list_comment_view/10'のようなものになります。 –
上記のリンクをクリックして "get_comments()"関数を実行しますか? –
私はそう思っています、私は私も私のためにビューを読み込むと思ったので、私もそれをやったと思います。しかし、何も表示されていません。 – user1125233