Drupal

Top 6 Drupal Modules To Build Any Website

I have been doing large amounts of messing on on all my Drupal based sites lately (99%), but one thing I have been experimenting with mostly is building what I want from scratch by using nothing but a few, very powerful Drupal modules!

 

1 - Views


How To Place A Drupal Block Anywhere On Your Site

You might have noticed on the homepage of my site I have the 'Recent Comments' block integrated and floating inside my recent posts. Taught I would share how to do this. This is actually quite simple to do, all you need is this code:

<?php
$block = module_invoke('module_name', 'block', 'view', 0);
print $block['content'];
?>

Place that code anywhere you want a block to appear, just simply replace module_name with the name of the block you want to be shown, for my comment block it was as simple as changing it to comment


Change Amount of 'Recent Comments' in Drupal

I was setting up the new 'Recent Comments' block on the front page today. It was initially showing 10 comments, the default Drupal amount, but this was too much it was just cluttering. So I found a way to change the default number, it's a bit messy but it works. Here's how to do it:

Open the comment.module file, located in the modules folder in your drupal home directory. In your text editor around line 300 you will see a line that reads

function comment_get_recent($number = 10)