Skip to content

Instantly share code, notes, and snippets.

@jordanmaslyn
jordanmaslyn / gist:2861878
Created June 3, 2012 04:25
CodeIgniter: .htaccess file (from CodeIgniter.tv)
<IfModule mod_rewrite.c>
# allow_override On
# mod_rewrite is installed
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
@jordanmaslyn
jordanmaslyn / gist:2855137
Created June 1, 2012 21:02
CodeIgniter: New Controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Controllername extends CI_Controller {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
@jordanmaslyn
jordanmaslyn / gist:2854905
Created June 1, 2012 20:20 — forked from hmert/slug.php
PHP: Create Slug Function
function create_slug($string){
$string = preg_replace( '/[«»""!?,.!@£$%^&*{};:()]+/', '', $string );
$string = strtolower($string);
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}