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 autosave(last) | |
{ | |
if (typeof t!="undefined") {clearTimeout(t);} // reset timer | |
var data = new Object(); | |
var interests = new Object(); | |
var interestscount = 0; | |
$('#myform input,#myform textarea,#myform select').each(function(index) { | |
if ($(this).is(':submit')){ | |
// ignore submit buttons | |
} else { |
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
<form method="post" id="myform" action="/saveform"> | |
Name: <input name="name" type="text" value="" /><br /> | |
Address: <textarea name="address"></textarea><br /> | |
Gender: <select name="gender"> | |
<option value="M">Male</option> | |
<option value="F">Female</option> | |
</select><br /> | |
Interests:<br /> | |
1: <input name="interests[]" type="text" value="" /><br /> | |
2: <input name="interests[]" type="text" value="" /><br /> |
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
$.ajax( | |
{ | |
type: "POST", | |
url: "/ajax/autosave", | |
data: data, | |
cache: false, | |
success: function(message) | |
{ | |
if (message == '1'){ // show success saved | |
t = setTimeout("autosave()", 60000); // set timer for next autosave |
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() | |
{ | |
// Find all members, limit by 5, order by date | |
$members = $this->Users->getAll(5,array('date' => -1)); | |
$data = array( | |
'members' => array() | |
); | |
while($members->hasNext()){ // While we have results | |
$member = $members->getNext();// Get the next result | |
$data['members'][] = 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 Users extends CI_Model { | |
function __construct() { | |
parent::__construct(); | |
$tableName = 'users'; | |
$primaryKey = 'id'; | |
// Connect to Mongo | |
$this->connection = new Mongo('localhost:27017'); |
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> | |
<hr /> |
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(); |
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 ($allRecords->num_rows() > 0) | |
{?> | |
<table cellpadding="4"> | |
<tr> | |
<td>Name</td> | |
<td>Email</td> | |
<td>Phone</td> | |
</tr> | |
<?php |
OlderNewer