Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
jehoshua02 / controllers_product.php
Created March 2, 2012 20:29
Playing around with nested views
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Product extends CI_Controller {
public function index()
{
// TODO Product->index()
}
public function add()
@jehoshua02
jehoshua02 / controllers_auth.php
Created March 2, 2012 22:30
CI layout demonstrated by Shawn McCool heybigname.com/2011/08/26/codeigniter-2-sparks-php-activerecord-part-4-views-and-layouts/
<?php
class Auth extends MY_Controller
{
function login()
{
if ($_POST)
{
// The user has submitted the login form
$user = User::validate_login($_POST['username'], $_POST['password']);
@jehoshua02
jehoshua02 / _notes.md
Created March 3, 2012 06:59
CodeIgniter page/layout/content views

Why I like this approach ...

I like this approach because it relieves the controllers from much of view rendering responsibility while still leaving the controller the power to alter the view rendering process a great deal.

Lingering concerns ...

However, my gut tells me that this approach still hides a non-trivial flaw. I wonder how this approach will cope with swapping out layouts or pages, and actually generating parts of the total view that require increased intricate logic and heavier data requirements.

The goal ...

@jehoshua02
jehoshua02 / url_base.php
Created March 11, 2012 04:34
Determine url base reliably
<?php
class Controller {
private $_base_url;
// ...
public function base_url()
{
@jehoshua02
jehoshua02 / action_string.php
Created March 13, 2012 20:53
extract() example
<?php
class Router {
// ...
private function _action_string($parsed_action)
{
// without extract
$parsed_action['params'] = implode('/', $parsed_action['params']);
@jehoshua02
jehoshua02 / error.md
Created April 17, 2012 21:39
trying to get apache alias to play nice with rewrite ...

Not Found

The requested URL /projects/mysite/public_html/index.php/Some-URI-Segments was not found on this server.

@jehoshua02
jehoshua02 / partials_jquery.js
Created April 24, 2012 18:18
loading partials with JQuery ...
function load_partial(element) {
if (element == undefined) {
$('.partial').each(function () {
load_partial(this);
});
return;
}
else
{
var action = element.id.replace('_', '/');
@jehoshua02
jehoshua02 / phploc_zf_1.11.11.md
Created June 12, 2012 04:03
phploc on ZendFramework
$ phploc ZendFramework/1.11.11/ --suffixes php
phploc 1.6.4 by Sebastian Bergmann.

Directories:                                        952
Files:                                             4338

Lines of Code (LOC):                             957378
  Cyclomatic Complexity / Lines of Code:           0.06
Comment Lines of Code (CLOC):                    322389
@jehoshua02
jehoshua02 / margin-test.html
Created September 4, 2012 15:47
margins are not additive ... seems to take the max margin of the two elements.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>margin test</title>
<style type="text/css">
.hello {
background-color: blue; margin-bottom: 8px;
@jehoshua02
jehoshua02 / xdebug.ini
Created September 7, 2012 22:38
how I have my xdebug configured ...
[xdebug]
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.collect_params = 4