Skip to content

Instantly share code, notes, and snippets.

View BramEsposito's full-sized avatar
🌊

Bram Esposito BramEsposito

🌊
View GitHub Profile
@BramEsposito
BramEsposito / ping.php
Created February 13, 2015 09:46
PHP Pinger
<?php
// from: http://stackoverflow.com/questions/7372780/creating-a-ping-uptime-service-with-php
// TODO: add string recognition to check specific pages
//Config information
$email = "[email protected]";
$server = "google.com"; //the address to test, without the "http://"
@BramEsposito
BramEsposito / drupal_message_to_admin.php
Created December 29, 2012 08:33
Display a message to a Drupal administrator only
<?php
if(user_access('administer')) {
drupal_set_message("hello Admin!");
}
@BramEsposito
BramEsposito / drupal_custom_views.php
Last active December 10, 2015 08:08
Drupal: Embed a view with custom parameters. (works in node body with PHP text format == dirty hack)
<?php
$display_id = "departement";
$args = array("view argument");
$view = views_get_view('view machine name');
$view->items_per_page = 0; // set number of items per page. 0 is all.
$content = $view->execute_display($display_id, $args);
print($content['content']);
@BramEsposito
BramEsposito / drupal_fields_from_entity.php
Last active December 10, 2015 08:08
Drupal: get field items from entity
<?php
$items = field_get_items('node', $node, 'field_yourfield', $node->language);