Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* CONTROLLER */
- class Home extends CI_Controller {
- function __construct()
- {
- parent::__construct();
- $this->load->database();
- }
- function index()
- {
- $sql = $this->db->query("select * from fc_users");
- $d = $sql->result_array();
- print_r($d);
- $body["meta_title"] = $this->Ca_get->getSetting('meta','sentence');
- $body["meta_description"] = $this->Ca_get->getSetting('meta','sentence2');
- $body["meta_keywords"] = $this->Ca_get->getSetting('meta','sentence3');
- $body["meta_author"] = $this->Ca_get->namesite();
- $this->load->view("frontend/".$this->Ca_get->name_template()."/view/containerview-home",$body);
- }
- }
- ?>
- <!-- MODEL -->
- <?php
- class Ca_get extends CI_Model {
- function __construct()
- {
- parent::__construct();
- $this->load->database();
- $this->load->library('session');
- }
- //Value
- function getValue($table, $field, $where)
- {
- $query = $this->db->query("SELECT $field FROM $table $where");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- //print_r($hasil);
- return $hasil->$field;
- } else return FALSE;
- }
- function getArray($select,$table,$where,$out){
- $q = mysql_query("select $select from $table where $where");
- $data = array();
- while($f = mysql_fetch_array($q))
- {
- $data[] = $f[$out];
- }
- $output = implode(",",$data);
- echo $output;
- }
- //Count
- function getCount($table, $where="")
- {
- if($where != ""){
- $query = $this->db->query("SELECT count(*) as count FROM $table where $where");
- }else if($where == ""){
- $query = $this->db->query("SELECT count(*) as count FROM $table");
- }
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- //print_r($hasil);
- return $hasil->count;
- } else return FALSE;
- }
- //Author
- function getAuthor($id=0)
- {
- if ($id == 0) return FALSE;
- $query = $this->db->query("SELECT * FROM fc_users WHERE users_id='$id'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- $name = $hasil->name;
- $ext = explode(" ", $name);
- return $ext[0];
- } else return FALSE;
- }
- function getEmailauthor($id=0)
- {
- if ($id == 0) return FALSE;
- $query = $this->db->query("SELECT * FROM fc_users WHERE users_id='$id'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- return $hasil->email;
- } else return FALSE;
- }
- function getImageauthor($id=0)
- {
- if ($id == 0) return FALSE;
- $query = $this->db->query("SELECT * FROM fc_users WHERE users_id='$id'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- return $hasil->img_url;
- } else return FALSE;
- }
- function getPost($id=0,$object)
- {
- if ($id == 0) return FALSE;
- $query = $this->db->query("SELECT * FROM fc_post WHERE post_id='$id'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- return $hasil->$object;
- } else return FALSE;
- }
- function getUsers($id=0,$object)
- {
- if ($id == 0) return FALSE;
- $query = $this->db->query("SELECT * FROM fc_users WHERE users_id='$id'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- return $hasil->$object;
- } else return FALSE;
- }
- function getSetting($cat="",$object="")
- {
- if ($cat == "") return FALSE;
- $query = $this->db->query("SELECT * FROM fc_setting WHERE category = '$cat'");
- if ($query->num_rows() > 0) {
- $hasil = $query->row();
- return $hasil->$object;
- } else return FALSE;
- }
- //Email
- function emailsite()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["email"];
- }
- return $output;
- }
- //Map
- function mapsite()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["map_location"];
- }
- return $output;
- }
- //Name Site
- function namesite()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["name"];
- }
- return $output;
- }
- function phone()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["phone"];
- }
- return $output;
- }
- function address()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["address"];
- }
- return $output;
- }
- function profile()
- {
- $q = $this->db->query("select * from fc_company_profile");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["profile"];
- }
- return $output;
- }
- function name_template()
- {
- $q = $this->db->query("select * from fc_template where active_status = 'Active'");
- $q = $q->result_array();
- foreach ($q as $row){
- $output = $row["template_folder"];
- }
- return $output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment