我有3个表,第一个是表名 Post
,第二个是 comment
,第三个是 { {1}} 即可。我想显示所有3个表,但我的代码太长了。你能建议我吗?
defineComment
我也尝试下面的代码,但它不起作用。
$r = $this->w->listwall();
if($r)
{
foreach($r as $key)
{
// load comment to view data
$pc['pc_comment'] = $this->w->get_comments($key['p_id']);
$data['wall'][] = [
'u_id'=>$key['u_id'],
'p_id'=>$key['p_id'],
'u_fname'=>$key['u_fname'],
'u_lname'=>$key['u_lname'],
'p_text'=>$key['p_text'],
'p_date'=>$key['p_date'],
'u_pf' =>$this->pf->getprofile($key['u_id']),
'p_img'=>$this->w->getimg($key['p_id']),
'cover'=>$this->w->getcoverimg($key['p_id']),
'bgpf' =>$this->w->getbgimg($key['p_id']),
'p_link'=>$key['p_link'],
'pc_comment'=>$this->w->get_comments($key['p_id']),
'pc_count'=>$this->w->get_count_comment($key['p_id']),
'pc'=>$this->load->view('wall/v_comment_wall', $pc, TRUE),
'p_like'=>$this->w->get_list_like($key['p_id']),
'count_like'=>$this->w->count_like_post($key['p_id'])
];
}
$data['pf'] = $this->pf->getprofile(uid());
//$data['edittext'] =
//if(count($data) >= 1){
$this->load->view('wall/v_wall',$data);