Drupal 6 & Drupal 7

Drupal Display PHP Errors on One Domain of Multi Site

When using a multi-site setup, You may want errors only to appear for one site. In that case, use $_SERVER[‘HTTP_HOST’] in an if statement to only display PHP error messages for the domain of your choice: <?php if ($_SERVER[‘HTTP_HOST’]===’specific.domain-you-want.here’) { error_reporting(E_ALL); ini_set(‘display_errors’, TRUE); ini_set(‘display_startup_errors’, TRUE); } ?>

How to Understand PHP Stream Wrapper Context and Options

Some have a difficult time understanding what is meant in PHP by stream wrappers, context options and parameters. Judging by a few conversations with other developers, its obvious there is a bit of confusion about what a stream wrapper is and why it would have a context. While the PHP documentation does adequately describe what… Read more How to Understand PHP Stream Wrapper Context and Options

drush cc Not Showing All Options (only showing 2 options cancel and drush)

Trying to clear your Drupal site chache with drusch cc or drush cc all? Drush should out put a list in response that looks like this: promt$> drush cc Enter a number to choose which cache to clear. [0] : Cancel [1] : all [2] : drush [3] : theme-registry [4] : menu [5] :… Read more drush cc Not Showing All Options (only showing 2 options cancel and drush)

Drupal: How to solve Warning: file_put_contents The file could not be created

Sometimes when migrating or setting up a local development site you may run into an error that looks like this: Warning: file_put_contents(temporary://file8UThke): failed to open stream: “DrupalTemporaryStreamWrapper::stream_open” call failed in file_unmanaged_save_data() (line 1898 of /Users/YouUserName/path/to/docroot/includes/file.inc). Likely the Drupal temp directory isn’t writable. An easy fix for this is to navigate to /admin/config/media/file-system and enter the… Read more Drupal: How to solve Warning: file_put_contents The file could not be created

Drupal 7: How To Create a Views View from Within a Module (default view)

The whole idea in making a module is to make it, well ‘modular’, right? The person who is going to install the module should not have to create and configure a view. Chances are they would not get it just right anyway (you know, with all the exact settings the module depends upon). This is… Read more Drupal 7: How To Create a Views View from Within a Module (default view)

Drupal 7: How to Make a Drupal Theme Function in a Module

This is intended as a simple reminder for all of those out there who find making a drupal theme a bit confusing at times. There are three main steps that all work together. 1) hook_theme which adds an array of callbacks and their arguments to the theme registry. You need to put this in your… Read more Drupal 7: How to Make a Drupal Theme Function in a Module