Friday, April 16, 2010

Change date format in excel sheet

Hi,
I always prepare my documents in excel and i like it. I faced the problem when entering dates in the column, those are always formated to mm/dd/yy format even i entered in whatever format.
The solution i got is : Select formtat cells -> numbers -> date -> select custom format

Drupal load block content in any page

To Load block content in any page use below code in drupal

$blockView = module_invoke(, 'block', 'view', );
print($blockView['content']);

Where modulename is the type of the block, i.e you can create blocks in different ways like using views module, using taxonomyblock module etc. and delta is the numeric id of the block.

Example: below is the code to call a block which was generated using taxonomymenu block module.
$blockView = module_invoke('taxonomyblocks', 'block', 'view', 2);
print($blockView['content']);
?>


Display blocks based on some content types
$match = FALSE;

// block is visible on the content types entered here
$types = array('story' => 1, 'page' => 1);
$url = request_uri();

if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));
$match = isset($types[$node->type]);
}

// block is invisible on URLs entered here
if (strpos($url, "edit")) {
$match = FALSE;
}

// copy paste these for additional URLs
if (strpos($url, "admin")) {
$match = FALSE;
}

return $match;
?>

Reference
http://drupal.org/node/26502
http://drupal.org/node/345361