Skip to content

Instantly share code, notes, and snippets.

// CakePHP Block Helper
// Ever wanted a clean way to capture a block of HTML in your CakePHP view and use it later in your layout just like CakePHP uses $content_for_layout?
// I use Rails all the time and take content_for for granted. I recently started a CakePHP project and noticed the absence of a simple content_for method to capture a block of HTML.
// For this example we are creating a helper named $cake, a controller named 'main', and using a layout named 'app'.
// HELPER:
// CakePHP Block Helper
// Ever wanted a clean way to capture a block of HTML in your CakePHP view and use it later in your layout just like CakePHP uses $content_for_layout?
// I use Rails all the time and take content_for for granted. I recently started a CakePHP project and noticed the absence of a simple content_for method to capture a block of HTML.
// For this example we are creating a helper named $cake, a controller named 'main', and using a layout named 'app'.
// HELPER:
// CakePHP Enkoder
// USAGE:
// Uses the same syntax as $html->link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle)
<?=$enkode->mailto('Email Me', 'user@example.com', array('subject'=>'Hello world!'))?>
// HELPER:
// app/views/helpers/enkode.php
@chrisyour
chrisyour / gist:11183907
Created April 22, 2014 15:36
Build Help: Get Started with Rails
# Open bash.rc in Terminal using the 'mate' command
mate ~/.bashrc
# Do you have this line in your .bashrc file? The PostgresApp should have added PostgresApp to your PATH.
PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"