This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Buttons extends CI_Model { | |
function __construct() { | |
parent::__construct(); | |
} | |
function checkDB(){ | |
$result = $this->redis->command('PING'); | |
if($result == 'PONG'){ | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Welcome extends CI_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
$this->load->helper('url'); | |
$this->load->library('redis'); | |
$this->load->model('Buttons','',TRUE); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(count($members) > 0): | |
foreach($members as $member => $fields):?> | |
<h1><a href="<?php echo site_url(array('welcome','view', $fields['id'])); ?>"><?php echo $fields['name']; ?></a> | |
<a href="<?php echo site_url(array('welcome','edit', $fields['id'])); ?>" style="font-size:12px;">Edit</a> <a href="<?php echo site_url(array('welcome','delete', $fields['id'])); ?>" style="font-size:12px;">Delete</a></h1> | |
<p><?php echo ($fields['address']); ?><br /> | |
<em>Phone: <?php echo $fields['phone']; ?><br /> | |
Added on <?php echo unix_to_human( $fields['date'] ); ?></em></p> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Users extends CI_Model { | |
protected $primaryKey = 'id'; | |
protected $tableName = 'users'; | |
function __construct() { | |
parent::__construct(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function index() | |
{ | |
$data = array( | |
'members' => array() | |
); | |
if (!$this->Users->table_exists()){ | |
$this->load->view('no_table', $data); | |
} else { | |
$members = $this->Users->getAll(5); // Find all members, limit by 5 | |
if (count($members) != 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __construct() | |
{ | |
parent::__construct(); | |
$this->load->helper('url'); | |
$this->load->helper('date'); | |
$this->load->model('Users','',TRUE); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function index() | |
{ | |
$data = array( | |
'members' => array() | |
); | |
if (!$this->Users->table_exists()){ | |
$this->load->view('no_table', $data); | |
} else { | |
$members = $this->Users->getAll(5); // Find all members, limit by 5 | |
if (count($members) != 0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($allRecords->num_rows() > 0) | |
{?> | |
<table cellpadding="4"> | |
<tr> | |
<td>Name</td> | |
<td>Email</td> | |
<td>Phone</td> | |
</tr> | |
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Cms extends CMS_Controller { | |
public function index() | |
{ | |
$this->load->model('Example','',TRUE); | |
$allRecords = $this->Example->getAll(); | |
$idOne = $this->Example->getById(1); | |
$data = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class MY_Model extends CI_Model { | |
/** Set this to the table name that the model is mapped to */ | |
protected $tableName; | |
/** Set this to the primary key of the table for this model.*/ | |
protected $primaryKey; | |
function __construct() { | |
parent::__construct(); |