Tracing available variables in template file

I often forget this one, if you need to see what available variables are in some specific template file of any contributed module you will write this on top of the tpl file

<pre> <?php print_r(get_defined_vars());?></pre>

and will get a nice list of variables you can use.

Drupal site and how to manually put it offline

Go to phpmyadmin and start this 2 commands

put site offline
UPDATE variable SET value='s:1:"1"' WHERE name = 'site_offline'
put site online
UPDATE variable SET value='s:1:"0"' WHERE name = 'site_offline

depending what you need, if you have drush you could also do that with drush.

Node export tips and problems

Currently I am moving nodes from one domain to other, with many images and cck fields. Problem I have other then browser timing out on large files when uploded through node export module is that also on smaller files, with few nodes seems that module sometimes works and sometimes doesnt. What I realized is that if you quickly select code to paste or export file, importing breaks.

Redirect Old domain to New domain using htaccess redirect

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Panels h1 title inline with sidebar

Currently many drupal themes like fusion have h1 title use all the width of the grid so you can't have a panel where h1 tag is just part of the grid, using content area and in the same line there is sidebar.

Drupal massive comment enable

When you enable, or dissable commenting in drupal, you will only affect new nodes, there is no bulk action for this in core (but it should be in my opinion, not every damn useful functionality does have to be in separate module). There are few ways to do it, some proper way would be to built action and then run VBO on nodes, but this is the most time consuming for sure.

Filefield paths best practices

Recently I had a site with +30 000 images, they were all in default drupal folder /files and ofcourse this started to make problems for my server but also if I wanted to manually do something, delete a file or use it this made that directroy unusable. So filefield paths (which should be in core) helps here.