Create a CRUD Test with MAMP, Slim, Redbeans PHP, Twig, Jquery UI and AJAX

Recently I’ve been learning Ruby and Ruby on Rails but I wanted to get up and running faster with some CRUD functionality on some of my existing websites. I didn’t want to use a full blown stack like Drupal, so I started looking into micro-php frameworks and found Slim.

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. Continue reading

WordPress Export XML Get Words and Sort by Frequency with Ruby and Nokogiri

I wanted to visualise occurrences of words on a blog I have at http://www.designmethodsandprocesses.co.uk with the D3 library.

So I exported the xml file from WordPress Tools->export. Then I am using Nokogiri to parse the items in the file, get the post content, split that into words, trim whitespace, sanitize with the Sanitize gem count the occurences and put them into a hash and then sort by occurences. I will then use this for my D3 visualisation probably showing word frequency similar to the word bubble visualisation.

Continue reading

Review of Business Collaboration Platform – Bitrix24

Bitrix24 is an online business collaboration platform. Bitrix24 serves users by providing collaboration tools such as document sharing, tasking, CRM, calendaring, search, and project management. These tools integrated in a social-style environment which incorporates user profiles, liking, commenting, chat, and content sharing.

A full list of features can be viewed here Continue reading

How do I use the Google Analytics API class from the Eden PHP project to access Analytics Data?

Often APIs are a pain. However, the Eden PHP Project is here to save the day. Here I demonstrate how to access Analytics data using the Google API and Eden. Remember to set up your credentials in the Google Developers Console / Google Cloud and set permissions for your Analytics user to be accessed from the account you are authorising with. I also used krumo() to display vars. Continue reading

What is the best iPhone To-do list app that uses GTD methodology?

Review of the Walker iPhone Productivity App (with GTD methodology).

Walker is a productivity app that differs from others  because it walks you through your task management and with a  clear guidance system. It implements ‘Getting Things’ Done by David Allen, which is a life/task management system that, I believe, this app makes easier to implement and maintain. Walker’s Kickstarter project was published on july 2012 and reached its goal in the first 16 days. Check out the project’s website.

I have been interested in the GTD method since 2008 when I started using a notebook to keep track of things I was thinking whilst cycle touring to capture creative notes. The paper notebooks quickly filled up, pages feel out, they lacked visual coherence and generally became difficult to manage.
Continue reading

How Do I Use A Field Formatter To Output Fields With A Custom Format In Drupal?

A field formatter outputs a field in a particular way. Copy the following code and change ‘mysite’ to your module name. Please leave a comment or get in touch if you have any questions.

  /**
/**
* Implements hook_field_formatter_info().
*/
function mysite_entities_field_formatter_info() {
  return array(
    'mysite_entities_sm4_comments' => array(
      'label' => t('SM4 Comments'),
      'field types' => array('list_boolean'),
    ),
  );
}

/**
* Implements hook_field_formatter_view().
*/
function mysite_entities_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $path = drupal_get_path('module', 'mysite_entities');
  if ($display['type'] == 'mysite_entities_sm4_comments') {
    foreach ($items as $delta => $item) {
      if ($item['value'] == 1) {
        $element[$delta] = array(
          '#markup' => theme('mysite_entities_field_formatter_' . $display['type'], array('element' => $item)),
        );
      }
    }
  }
  return $element;
* Implements hook_theme().
*/
function mysite_entities_theme($existing, $type, $theme, $path) {
  return array(
    'mysite_promo_list' => array(
      'path' => $path . '/templates',
      'template' => 'mysite-promo-list',
      'variables' => array('items' => array(), 'view_mode' => NULL,),
    ),
    'mysite_promo_item' => array(
      'path' => $path . '/templates',
      'template' => 'mysite-promo-item',
      'render element' => 'element',
    ),
    'mysite_entities_field_formatter_mysite_entities_sm4_comments' => array(
      'path' => $path . '/templates',
      'template' => 'mysite-social-comments',
      'variables' => array('element' => NULL),
    ),
  );
}


}

How Do I Use Db Select In Drupal?

Returns a new SelectQuery object for the active database. More information available at https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_select/7

Example:

$query = db_select('node', 'c')

->fields('c')
->execute()
->fetchAssoc();
var_dump($query);

$query = db_select('node','n')
->condition('n.nid','5')
->fields('n')
->fields('p');
$query->Join('field_fieldname','p','p.entity_id = n.nid');
$result = $query->execute();

while($record = $result->fetchAssoc()) {
print_r($record);
}