관리-도구
편집 파일: Newsmodel.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Newsmodel extends CI_Model { public function __construct() { parent::__construct(); $this->load->library('session'); } public function get(){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("news"); $this->db->where(["news_status"=>1,"news_datetime_stamp>="=>$today_datetime_stamp]); $this->db->order_by("news_datetime_stamp","DESC"); $this->db->order_by("news_displayorder,news_id","DESC"); $result = $this->db->get(); return $result->result(); } public function find($id){ $today_date = date("d-F-Y"); $today_datetime_stamp = strtotime($today_date); $this->db->select("*"); $this->db->from("news"); $this->db->where(["news_id"=>$id,"news_status"=>1,"news_datetime_stamp>="=>$today_datetime_stamp]); $this->db->order_by("news_datetime_stamp","DESC"); $this->db->order_by("news_displayorder,news_id","DESC"); $result = $this->db->get(); return $result->result(); } }