Blocks

webmaster's picture

Tabbed Blocks

in

How do you creat tabbed blocks in Drupal ?

Eg on: http://stilbuero.de/jquery/tabs/#section-1

Check the solution on http://drupal.org/node/89338

admin's picture

Place blocks anywhere on the site

in

If you want to place blocks on a page or story or anywhere on your site , or on front page , here is a quick trick

Code for Recent Comments:


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

Code for who's online:

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

If you have event module installed you can show list of upcoming events

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

Display a custom block created by Admin :

admin's picture

Top posters with total number of members

in

Displays Top posters with total number of members like on http://csqa.info

<?php $users = db_query("SELECT COUNT(nid) AS count, {users}.uid, {users}.name FROM {node} LEFT JOIN {users} ON {node}.uid = {users}.uid WHERE {node}.uid != 0 GROUP BY uid ORDER BY count DESC LIMIT 5");
while ($user = db_fetch_object($users)) {
print "uid."\">".$user->name."";
}
?>

<?php $users1 = db_query("SELECT Count(uid) as count1 from users");
while ($user1 = db_fetch_object($users1)) {
print "Total members: ".$user1->count1;
}
?>

admin's picture

Display joining date on Who's new block.

in

You will have to hack the user.module for this. So be careful while you upgrade.

Find this place at around line 570 in user.module (in function user_block):

<?php
case 2:
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
$result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);
while ($account = db_fetch_object($result)) {
$items[] = $account;
}
$output = theme('user_list', $items);

admin's picture

Add Scrollbars in Blocks

in

You can add scrollbars to blocks and make all the blocks of the same size. It works on IE and Firefox.Here is how you do it.Open you theme stylesheet ( style.css ) & add following code:


div.inner {
}

div.outer {
height: 200px;
overflow-y: scroll;
}

This will add horizontal scroll bar. If you wish to enter a vertical scrollbar too.. add the following line.

div.outer {
height: 200px;
overflow-y: scroll;
overflow-x: scroll;
}

's points

Points are visible to logged in users only

descriptionvalue
Members3513
Posts224
Comments124
Reads today
Reads all time
Hits today0