[英]Activerecord CodeIgniter 3
I'm trying to count the number of items in my database within my card, but it's not working. 我正在尝试计算卡中数据库中项目的数量,但是它不起作用。
This is my home.html 这是我的home.html
Where my date-to is already included 我的约会对象已经包括在内
<div class="content">
<div class="text">ITEMS</div>
<div class="number count-to" data-from="0" data-to="<?= $active_properties; ?>" data-speed="1000" data-fresh-interval="20"></div>
</div>
And this is my home_model 这是我的home_model
public function get_active_properties(){
return $this->db->count_all('ci_properties');
}
And my controller home 而我的控制器家
public function __construct(){
parent::__construct();
$this->load->model('user/home_model','home_model');
}
public function index(){
$lista = $this->home_model->listAll();
$dados = array("ci_properties" => $lista);
$dados['active_properties'] = $this->home_model->get_active_properties();
$dados['title'] = 'Home';
$dados['view'] = 'user/home/home';
$this->load->view('layout', $dados);
}
我这样解决了
<div class="number count-to" data-from="0" data-to="" data-speed="1000" data-fresh-interval="20"><?= $active_properties; ?></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.