Block Subtitle

By: Arshad

21 Jun 2010

On the new web project im working, i needed extra titles to be added to menu and blocks. A quick search on d.o return no results for block subtitle. so here goes a new project i created.

This module allows a user to add subtitle to blocks.

I've created a patch for the gmap module. This goes under feature enhancement. It enables the use of the extinfowindow to style the info window for markers. Custom theme can be easily created. I've included a tutorial in the README.txt file in the extinfowindow directory.

This patch is compatible with the latest dev version 6.x-1.x-dev - 2010-Apr-09

To install, apply the patch. Download extinfowindow and extract under /sites/all/modules/gmap/thirdparty.

You can enable the extinfowindow at http://example.com/admin/settings/gmap .

Thanks

By: Arshad

11 Apr 2010

I want to take the time to thank everyone who participated in the sprint this weekend. As requested i'll be starting a series of advanced tutorials on Drupal as from now.

I know im very late to this party but this wasnt in my plan when i started this site. I wanted to write about simple but useful Drupal. After yesterday's massive rush to this homepage and the surge of pageviews on my analytics account, everything changed. It had to.

So there we are. I'll now start some serious Drupal coding. Keep watching this space. ;)

From my handbook page on d.o

This little code snippet will add the present page title to the breadcrumb. We show you how to use this in steps.

Step 1 : If you do not have a template.php file in your sites/all/themes/yourtheme/ folder, create one.

Step 2 : Copy and paste this code in the template.php file.

Tweaks

By: Arshad

25 Mar 2010

Drupal Page for Module Tweak

Ever had the bad experience of building a drupal view with 10 fields then realise you don't need 8 of those? Your next logical step is to edit each row and hit that remove button furiously. It gets worse if the server is slow and the ajax is playing up. Here's a quick and easy way to delete multiple fields at one.

Step 1 : Click on the "order row" icon in the fields box in View.

Step 2 : A new container pops up with all your fields in it. Here you can drag and drop to reorder.

Most of us have more than many functions in our template.php file. Hooks and preprocess function to make our site look as good as the designer did it. In many cases where a site requires advanced theming,the template.php file gets huge. To keep a structured and clean coding style consider using file includes. This way you can have codes in seperate php files loaded into template.php during execution.

This is a very similar approach to how Drupal core calls files from the "includes" folder.

Here's the code to include files :

An alternative to print_r in Drupal

By: Arshad

20 Mar 2010

How many times do we use a quick print_r to see what's in $node or $result or anything else? When coding modules , it's not very easy to output data structures to the screen unless you do a print_r($node) and view the source code. or do it like this :

[php]<pre><?php print_r($node); ?></pre>[/php]

Here's a clean and simple way you can output such data on screen. If you have the developer module enable (devel), use the dsm() (drupal_set_message) function.

Unique class for list items in drupal

By: Arshad

19 Mar 2010

I'll go directly to the code

This one goes in your template.php (under sites/all/themes/yourtheme/).

  1. function phptemplate_menu_item_link($link) {
  2. if (empty($link['localized_options'])) {
  3. $link['localized_options'] = array();
  4. }
  5. if (empty($link['localized_options']['attributes']['class'])) {
  6. $link['localized_options']['attributes']['class'] = 'menu-'. $link['mlid'];
  7. }
  8. else {
  9. $link['localized_options']['attributes']['class'] .= ' menu-'. $link['mlid'];
  10. }
  11. return l($link['title'], $link['href'], $link['localized_options']);
  12. }

Step 1 : Since we'll be using php codes in a block to display menu, the first thing to do is to enable the PHP Filter under modules.

Step 2 : Go to administer->block->add block and create a new block. Add a description (i use submenu). Choose PHP Code as the filter and paste the code below in the body textarea.

About Me

Arshad Chummun Hello I'm Arshad. I'm a 21 years old Drupal Web Developer. This is a site i put up for some reasons i can't remember and this is where i write stuffs i need to remember.;)

In the Web world, i head the Drupal Mauritius User Group and the jQuery user Group Mauritius and i'm a campus representative for Mozilla Firefox. 

DrupalCon CPH 2010

Copenhagen August 23 -27

Drupalcon CPH 2010