dongzhan1570 2016-10-24 06:59
浏览 41

Php代码无法在CodeIgniter中加载的视图中呈现

I have a controller which has following function

public function listartistes () {

        $this->set_language();

        $this->data['title'] = "Create Your Own Show Today";
        $this->data['meta_title'] = "Create Your Own Show Today";
        $this->data['meta_desc'] = "Create Your Own Show Today";


            $this->data['content']  = 'artiste/list';

            $this->data['artistes'] = $this->artistes_m->getAllArtistes(); 

        $this->load->vars($this->data);
        $this->load->view('template');
    }

As you can see the controller is loading the template view and inside template view we load the 'content' file like this this

 <div class="container-full">

        <?=$this->load->view($content);?>
    </div>

So far so good . but when I try to put any PHP code in list which is inside

/artiste/list its not showing on my browser only blank screen

  • 写回答

1条回答 默认 最新

  • drryyiuib43562604 2016-10-26 00:33
    关注

    The partial pattern in CodeIgniter allows consecutive views to be loaded, not embedded ones. So this means that you might need a partial for header, content and footer for example instead of an outer template and inner [content] template.

    So while you may have to adjust what markup and data is in which view, you will probably be best off putting $this->load->view($content); on the line after $this->load->view('template'); in the controller. I don't think that CodeIgniter is capable of loading views from within views.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line