Drupal core

tpl.phps are not templates

Drupal's template files (*.tpl.php) are not really templates. This is what my DrupalCon core developer summit submission is about. The slides briefly explain why tpl.phps are not real templates, what real templates are, why this is a problem for the Drupal project and community, and mentions some possible solutions to the problem. It also provides some basic guidelines as a starting point for tpl.php standards, should that be pursued.

Drupal Gotchya: Cache_get() Returns Expired Items

cache_get() returns $cache objects even if the cached item is stale (expired). The cached data will not be rebuilt every hour in the following example:

* Builds complicated data for the monkey grip.
function custom_monkey_grip_data() {
// Return the cached data
$cache = cache_get('custom:monkey_grip');
  if (!
$cache) {
// Some expensive processing to build the data.
$data = complicated_recursion_and_loops_on_lots_of_data();
// Cache the data and rebuild it every hour
$expire = time() + (60 * 60);
cache_set('custom:monkey_grip', $data, 'cache', $expire);
  else {
$data = $cache->data;

read more

Syndicate content