hook_menu() implementations return an associative array whose keys define paths and whose values are an associative array of properties for each path. (The complete list of properties is in the return value section below.)
Sunday, April 8, 2012
Friday, March 23, 2012
Friday, March 2, 2012
Get the path to a Drupal module or theme
Suppose you have a image file in your custom module
Best way to take that image is
<img src="<?php echo base_path().drupal_get_path('module', 'module_name');?>/image_name.jpg" />
http://data.agaric.com/get-path-drupal-module-or-theme
Best way to take that image is
<img src="<?php echo base_path().drupal_get_path('module', 'module_name');?>/image_name.jpg" />
http://data.agaric.com/get-path-drupal-module-or-theme
Labels:
Drupal
Saturday, January 21, 2012
php.net makes few events bold, those are running close to you
php.net shows few upcoming events in bold.
I guess they are making them bold country wise. So suppose you are from india, all indian event will be bold for you. It helps site user, to filter out events which is useful for them.
Wednesday, January 11, 2012
Drupal custom status message on node submission
Drupal Content types are used for variety of features in a project. So when user submits a form, s/he gets a generic message "your "typename" has been created".
Best way to change these messages, and get a complete control over them is
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
global $user;
switch ($op) {
case "view":
global $_SESSION;
if ($_SESSION['messages']['status']) {
foreach ($_SESSION['messages']['status'] as &$value) {
if (substr($value, -17) == 'has been created.') {
switch ($node->type){
case 'contact_us_website':
$value = "Contact Us form has been submitted. We have received your comments - Hawaii Savvy Team";
break;
case 'report_problem':
$value = "Report problem form has been submitted. We have received your comments - Hawaii Savvy Team";
break;
case 'event':
if(!(user_has_role('Administrator') || $user->uid==1))
$value = "Your Event has been submitted. We will publish it very soon - Hawaii Savvy Team";
break;
....
......
For other ways look http://drupal.org/node/500202#comment-2210030
Best way to change these messages, and get a complete control over them is
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
global $user;
switch ($op) {
case "view":
global $_SESSION;
if ($_SESSION['messages']['status']) {
foreach ($_SESSION['messages']['status'] as &$value) {
if (substr($value, -17) == 'has been created.') {
switch ($node->type){
case 'contact_us_website':
$value = "Contact Us form has been submitted. We have received your comments - Hawaii Savvy Team";
break;
case 'report_problem':
$value = "Report problem form has been submitted. We have received your comments - Hawaii Savvy Team";
break;
case 'event':
if(!(user_has_role('Administrator') || $user->uid==1))
$value = "Your Event has been submitted. We will publish it very soon - Hawaii Savvy Team";
break;
....
......
For other ways look http://drupal.org/node/500202#comment-2210030
Monday, January 9, 2012
Blogger is restricting category/tag pages for search-engines
Google webmaster reported me crawl error, that my blog's http://ashish-thakur.blogspot.com robots.txt restrict 14 url to crawl by search engines.
Blogger said robots.txt is here http://www.yourblogname.blogspot.com/robots.txt. which looks like:
I feel like this is one of the reason, we should not use blogger for high end seo website.
Blogger said robots.txt is here http://www.yourblogname.blogspot.com/robots.txt. which looks like:
User-agent: * Disallow: /search Allow: /
So my all tag urls are not indexable.. damn. And google says you can not change your robots.txt http://www.google.com/support/forum/p/blogger/thread?tid=18ba1cea84692c28&hl=en
I feel like this is one of the reason, we should not use blogger for high end seo website.
Monday, January 2, 2012
Converting Timestamp into calendar-clock time values
Dupal and other PHP open sources store time as timestamp into database.
So, while working or debugging on such DB tables, one has to convert it into calendar-clock time format (mm/dd/yy- hh:mm:ss). Reason could be anything.
For this, either write your own php code or use this tool
Unix Timestamp Converter
You should know timezone of your web application.
In drupal 6 it is in admin/settings/date-time
Now to get the GMT offset of this timezone one can use
The World Clock
Type the city name in search city field. Go to city page.
Here you can find your timezone's GMT offset.
So, both tools together helps you to undertand your db table time values.
So, while working or debugging on such DB tables, one has to convert it into calendar-clock time format (mm/dd/yy- hh:mm:ss). Reason could be anything.
For this, either write your own php code or use this tool
Unix Timestamp Converter
You should know timezone of your web application.
In drupal 6 it is in admin/settings/date-time
Now to get the GMT offset of this timezone one can use
The World Clock
Type the city name in search city field. Go to city page.
Here you can find your timezone's GMT offset.
So, both tools together helps you to undertand your db table time values.
Subscribe to:
Posts (Atom)

