Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
APP_ENV=local | |
APP_DEBUG=true | |
APP_KEY=PrO1fwe4gFRlOM2jnrXtYQ6oyf6o7ld3 | |
DB_HOST=localhost | |
DB_DATABASE=homestead | |
DB_USERNAME=homestead | |
DB_PASSWORD=secret | |
CACHE_DRIVER=file |
<?php | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| PDO Fetch Style | |
|-------------------------------------------------------------------------- | |
| | |
| By default, database results will be returned as instances of the PHP |
// for auto_nodetitle module | |
<?php | |
$count = db_select('node')->fields('node')->condition('type', $node->type)->execute()->rowCount(); | |
$id = $count+1; | |
$title = 'stg'.$id; | |
$nodes = db_select('node', 'a')->fields('a', array('title'))->condition('type',$node->type)->execute(); | |
foreach ($nodes as $nod) { | |
if ($title == $nod->title) { | |
$id = $id + 1; | |
$title = 'stg'.$id; |
<?php | |
global $base_path; | |
if (isset($data->field_field_civilite[0]['rendered']['#markup'])) { | |
$civilite = $data->field_field_civilite[0]['rendered']['#markup']; | |
} | |
else { | |
$civilite = 'no civilite'; | |
} | |
if (isset($data->field_field_prenom[0]['raw']['value'])) { | |
$prenom = $data->field_field_prenom[0]['raw']['value']; |
<?php | |
$date_start = new DateTime($data->field_field_date_conge[0]['raw']['value']); | |
$date_end = new DateTime($data->field_field_date_conge[0]['raw']['value2']); | |
$diff=date_diff($date_start,$date_end); | |
echo $diff->format("%a jours"); | |
?> |
//You can easily memorize it if you consider telling tar to e X tract a F ile | |
tar xf community_images.tar.gz -C /home/emmys/Pictures/Community/ | |
//You can run the following command to reveal your server’s IP address. | |
ifconfig eth0 | grep inet | awk '{ print $2 }' | |
//To copy a file from B to A while logged into B: | |
scp /path/to/file username@a:/path/to/destination | |
//To copy a file from B to A while logged into A: | |
scp username@b:/path/to/file /path/to/destination | |
//Make sure the directory you are copying to on 192.168.0.4 is owned by the user username | |
chown username downloads |
Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
<?php | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: http://example.com/newpage.html"); | |
exit(); | |
?> |
/** | |
* Implements hook_entity_info_alter(). | |
*/ | |
function MYMODULE_entity_info_alter(&$entity_info) { | |
$entity_info['node']['view modes']['another_teaser'] = array( | |
'label' => t('Another teaser'), | |
'custom settings' => TRUE, | |
); | |
} |
(function ($) { | |
Drupal.behaviors.yourBehaviorName = { | |
attach: function (context, settings) { | |
//.. | |
} | |
}; | |
})(jQuery); |