programmer's blog
How to override theme function in Drupal 6?
Submitted by programmer on Sat, 04/24/2010 - 19:06.
::
In your template.php, use hook_theme() API function to override the output of the theme.
As an example, we use the code below in template.php:
<?php/**** In this case, we are overriding user_login functions*/function yourtheme_theme() { return array( 'user_login' => array( 'template' => 'user-login', 'arguments' => array('form' => NULL), ), );}?>
Top 3 Drupal Modules for Developers
Submitted by programmer on Sat, 04/24/2010 - 17:44.
::
Here, I would mention top 3 Drupal Modules without which all Drupal development is waste and which makes Drupal development for most kind of applications a breeze without writing much of code. Writing lesser code also means lesser chances that your code would crash or not work.
The list to useful Drupal modules is almost endless and it is very difficult to find out important drupal modules, but there are 3 giants command on whom is must for every Drupal developer:
Drupal CCK:
Load Ubercart "add to button"
Submitted by programmer on Fri, 06/05/2009 - 09:19.
::
<?php$node = node_load(10);print theme_uc_product_add_to_cart($node);?>
How to Debug PHP code? How to debug some vague php syntax error?
Submitted by programmer on Wed, 02/04/2009 - 13:25.
::
I was getting the following error:[Wed Feb 04 08:09:30 2009] [error] [client xxx.xxx.xxxx.xxx] PHP Parse error: syntax error, unexpected '<' in /sites/all/modules/views/views.module(542) : eval()'d code on line 1 I wrote this code in view.module line 542 to debug: $result = eval($view->view_args_php);global $user;if ($user->uid== 1){
Embedding a content type node form with Drupal 6
Submitted by programmer on Tue, 01/20/2009 - 09:12.
::
How do you invoke or embed a content type node form in Drupal 6? Following code shows how to:
<?php global $user; $type = 'garden'; $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); module_load_include('inc', 'node', 'node.pages'); $form = drupal_get_form($type .'_node_form', $node); print_r($form);?>
Display all Drupal messages iin a nice transparent pop-up div or lightbox
Submitted by programmer on Fri, 01/16/2009 - 08:10.
::
<?php if ($messages): ?> <div id="TB_overlay" class="TB_overlayBG" onclick="tb_remove()"/> <div id="TB_window" style="margin-left: -165px; width: 330px; margin-top: -97px; display: block;">
Drupal 6 revisted: Passing arguments through filters in Views
Submitted by programmer on Thu, 01/15/2009 - 13:52.
::
<?php$view = views_get_view('view_name'); // fetch the view$display_id = 'default'; // chose the display type$view->set_display($display_id);$view->is_cacheable = FALSE;
Drupal 6: Embeding View in a block
Submitted by programmer on Tue, 01/13/2009 - 10:22.
::
function hook_block($op = 'list', $delta = 0, $edit = array()) { switch ($op) { case 'list': $blocks[0]['info'] = t('Example Block'); return $blocks; case 'view': default: $view = views_get_view('view_name'); $view->set_display('default');
Drupal 6 Views embeding and passing filters
Submitted by programmer on Tue, 01/13/2009 - 10:10.
::
Load a view: <?php$view = views_get_view('view_name');?> Initalize it and add arguments. Fiddle with options as needed:
Performance Improvements in Drupal
Submitted by programmer on Thu, 12/18/2008 - 05:01.
::
The posting I made on drupal.org (http://drupal.org/node/346838): Usage of complex CCKs does come at a performance cost, since, the tables are not optimized. I have worked on Drupal performance and could get quite exceptional results with few of the techniques for some of the clients. Here are couple of things, that would make your Drupal site run quite fast: