This file contains 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 echo $this->url->link('product/category', 'path=96'); ?> | |
// http://example.com/category-three/ | |
<?php echo $this->url->link('product/category', 'path=63_78'); ?> | |
// http://example.com/category-one/category-two/ | |
<?php echo $this->url->link('product/category', 'path=63_78_96'); ?> |
This file contains 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
var arrayToTable = function (data, options) { | |
"use strict"; | |
var table = $('<table />'), | |
thead, | |
tfoot, | |
rows = [], | |
row, | |
i, |
This file contains 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
convert *.jpg -resize 236 -set filename:filename '%t-%wx%h' 'resized/%[filename:filename].jpg' |
This file contains 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
public function beforeSave(Model $model, array $options = array()){ | |
var_dump($model->data['User']); | |
//array (size=4) | |
// 'id' => string '66' (length=2) | |
// 'first_name' => string 'new first name' (length=14) | |
// 'last_name' => string 'new last name' (length=13) | |
// 'email' => string '[email protected]' (length=14) | |
$x = $model->find('first', array('conditions' => array($model->alias . '.' .$model->primaryKey => $model->id), 'contain' => 'User')); |
This file contains 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
/* | |
* If this doenst work then try the below | |
*/ | |
echo $this->Form->input('Applicant.date_of_birth', array( | |
'type' => 'date', | |
'dateFormat' => 'DMY', | |
'minYear' => date('Y') - 110, | |
'maxYear' => date('Y')- 18, | |
) | |
); |
This file contains 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
$dob = explode('-', $applicationData['Applicant']['date_of_birth']); | |
$dobDayArray = explode(' ', $dob[2]); | |
$dobDay = $dobDayArray[0]; | |
$dobMonth = $dob[1]; | |
$dobYear = $dob[0]; | |
echo $this->Form->input('Applicant.date_of_birth', array( | |
'type' => 'date', | |
'dateFormat' => 'DMY', |
This file contains 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
//current find results look like this | |
array | |
0 => | |
array | |
0 => | |
array | |
'year' => string '2012' (length=4) | |
'month' => string 'May' (length=3) | |
'count' => string '5' (length=1) | |
1 => |
This file contains 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
//set error handling up | |
libxml_use_internal_errors(true); | |
//path to the validation file | |
$validationSchema = dirname(__FILE__).DS.'docs'.DS.'tff'.DS.'XMLImport.xsd'; | |
//set up a new document to work with | |
$doc = new DOMDocument(); | |
$doc->formatOutput = true; | |
$doc->preserveWhiteSpace = false; |
This file contains 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
class User extends AppModel { | |
public $name = 'User'; | |
public $belongsTo = array( | |
'FriendOne' => array( | |
'className' => 'Friend', | |
'foreignKey' => 'friend_1_id', | |
), | |
'FriendTwo' => array( | |
'className' => 'Friend', | |
'foreignKey' => 'friend_2_id', |
This file contains 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 | |
$options = getopt('p:'); | |
$prefix = empty($options['p']) | |
? realpath('.') | |
: realpath($options['p']); | |
if (empty($prefix)) { | |
die("Bad prefix. Try again.\n"); | |
} |