Front page customisation like dashboard

Front page is your website's face and it should give the visitor a snapshot of all the important features on your site.

One of good examples of Front page is http://csqa.info. I would like to share how this was created.

The whole green block is an image and below that are the two-column blocks "Top weblinks" & "Most commented" which are php-snippets.

You will need:

1. FrontPage contributed drupal module
2. Create the image like you want
3. Code below

1. Install Front page module and goto admin/settings/front_page and customize the code as below.


Top Weblinks

Most Commented

<?php
$nlimit = 10;
$result1 = db_query(db_rewrite_sql("SELECT n.title, wn.clicks, w.lid
,wn.nid FROM {node} n
INNER JOIN {links_node} wn ON n.nid = wn.nid
INNER JOIN {links} w ON wn.lid = w.lid
WHERE n.type = 'weblink'
AND n.status = 1
AND n.moderate = 0
ORDER BY wn.clicks DESC
LIMIT $nlimit"));

while ($node = db_fetch_object($result1)) {
$items1[] = l($node->title, 'links/goto/' . $node->nid.'/'.$node->lid.'/links_weblink'). "($node->clicks)" ;
}
print theme_item_list($items1);
?>

<?php $most_popular = db_query('SELECT ncs.nid, n.title, n.created, ncs.comment_count FROM {node_comment_statistics} ncs JOIN {node} n ON n.nid = ncs.nid ORDER BY ncs.comment_count DESC LIMIT 0 , 8');
while($popular_post = db_fetch_object($most_popular)) {
$comment_date = date('m/d/Y', $popular_post->created);
$output[] = l($popular_post->title, "node/$popular_post->nid") . "($popular_post->comment_count)

Place blocks anywhere on the site

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: Drupal 5

How-To: 

Pages

Subscribe to My Drupal RSS