Skip to content

Instantly share code, notes, and snippets.

View jrvaja's full-sized avatar

Jaimin Vaja jrvaja

  • Adjust GmbH
  • Berlin, Germany
View GitHub Profile
@jrvaja
jrvaja / DB_QUERY
Created July 2, 2012 17:24
CodeIgniter: DB_Query
/*************************************************************************
Query With Multiple Results
**************************************************************************/
/*--------------------------------------------------------------*/
Obejct Version
/*--------------------------------------------------------------*/
$query = $this->db->query('SELECT name, title, email FROM my_table');
foreach ($query->result() as $row)
{
@jrvaja
jrvaja / TableHeadingChanger
Created June 29, 2012 13:41
CodeIgniter: TableHeadingChanger
$this->table->set_heading('Id','My Title','My Content');
@jrvaja
jrvaja / PaginationView-phpCode (1)
Created June 29, 2012 13:38
CodeIgniter: PaginationView-phpCode
<?php echo $this->table->generate($records); ?>
@jrvaja
jrvaja / Css-Link
Created June 29, 2012 13:36
CodeIgnietr: Css-Link
@jrvaja
jrvaja / htAccessFile
Created June 27, 2012 07:10
CodeIgniter:htAccessFile
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
@jrvaja
jrvaja / configurationFile
Created June 27, 2012 07:09
CodeIgniter:configurationFile
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
@jrvaja
jrvaja / AutoLoadFile
Created June 27, 2012 07:08
CodeIgniter:AutoLoadFile
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
@jrvaja
jrvaja / Controller_ActiveRecord1
Created June 27, 2012 07:07
CodeIgniter: Controller_ActiveRecord1
class Site extends CI_Controller {
//Shows data inserted and views
public function index()
{
if($query=$this->site_model->get_records()){
$data['records']=$query;
}
$this->load->view('option_view',$data);
}
@jrvaja
jrvaja / model_activeRecords1
Created June 27, 2012 07:04
CodeIgnite:model_activeRecords1
class Site_model extends CI_Model {
//Select all
function get_records(){
$query=$this->db->get('data');
return $query->result();
}
//Add Record
function add_record(){
$data=array(
'title'=>$this->input->post('title'),
@jrvaja
jrvaja / mailAttachmnetsCode
Created June 25, 2012 11:48
CodeIgniter:mailAttachmnetsCode
$path=$this->config->item('server_root');
$file=$path.'/CI25_06_2012/attachments/informa.txt';
$this->email->attach($file);