【问题标题】:creating data tables passing data to the view code igniter创建数据表,将数据传递给视图代码点火器
【发布时间】:2016-03-02 06:00:34
【问题描述】:

我看到让数据库表出现,类似于

$dataToBePassed = //SOME QUERY

$this->load->view('viewpage', $dataToBePassed);用于

但是我将如何使用模板呢?

就像我有这个将视图加载到我的模板中一样

  $data['content_view'] = 'viewpage';
  $this->templates->admin_template($data);

然后将传递给

//templates html codes
       <?php $this->load->view($content_view); ?>
//templates html codes

我该怎么做

//templates html codes
       <?php $this->load->view($content_view); ?>
//templates html codes

喜欢这个

//templates html codes
   <?php $this->load->view($content_view, $data); ?>
//templates html codes

【问题讨论】:

  • 您的编码中显示什么错误?
  • 你可以使用,你有什么错误吗?
  • 没有错误,但昨天我不知道我做了什么,但我认为我从检查元素错误中单击了某些内容,它显示模板变形并且正文显示 'Job_Titles/jobtitles_read', $data, FALSE.php 未找到

标签: php codeigniter view


【解决方案1】:

控制器

$data['view'] = 'your_view';
$data['content'] = $this->Model->fn_model();
$this->load->view('themplate',$data)

查看

<?php print_r($content); ?> // $content form $data['content']

【讨论】:

  • print_r($content);显示我想要的值。但是我该如何通过呢?
  • $this->load->view('themplate', $data) 对不起,我忘了这行
  • 在浏览器上按 F12 打开开发者模式并找到您的错误
  • 是的。我已经做到了。它说 jQuery-2.1.4.min.js:4 POST localhost/TLC_HR/Job_Titles/ajaxPaginationData/10 500 (Internal Server Error)
  • 我正在使用开源模板,所以我不知道如何解决这个问题。
猜你喜欢
  • 2018-08-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-03
  • 1970-01-01
  • 2012-12-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多