Hello,

I would like to create a front page that has a special block at the top that has the latest two nodes posted to a specific category. I would like these stories to be formated specially. Underneath of that block I would like to have all of the rest of the regular content that was promoted to front page. I want it to look something like this:

******HEADLINES*******
New product released
Go download it here....

Company opens new office
The new office allows new expansion
**********************

New application posted
Download from here

Blah blah blah
Filler text is dull...

This is fun.
Whipee!!

______

Is there an easy way to do this?
Thanks!

Comments

joe@www.joepilot.net’s picture

I actually did this to my website (www.joepilot.net) by modifying the block module. One of the problems with the block module is that the location flag is either one location signified by a '0' or the other as signified by something other than a '0'. I changed the listing to allow 3 locations for blocks, with the ability to add more.

First I added this code to the top of the block_list function in block.module:

static $blocks = array();
  $region_list = array('left'=>0, 'right'=>1, 'float'=>2);

Next I changed the following
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 '. ($region != 'all' ? 'AND region = %d ' : '') .'ORDER BY weight, module', $region == 'left' ? 0 : 1);
to
$result = db_query('SELECT * FROM {blocks} WHERE status = 1 '. ($region != 'all' ? 'AND region = %d ' : '') .'ORDER BY weight, module', $region_list[$region]);

The above change will allow new locations to be added by just changing the array.

Lastly, to enable the changes to be seen from the block admin page, you need to change two lines in the block_admin_display function. I called my new location "float", as in "floating" on the front page. Find the two lines that follow one after the other, both very long, which start out with
$row = array($block['info']...

Near the end of both of these lines, you'll find the code
array(t('left'), t('right'))
Replace this with
array(t('left'), t('right'), t('float'))
and now you have a new block location!

The code I used to actually get the block only to appear on the front page is as follows in the .theme (joepilot.theme) in the _page function.

if (($blocks = theme_blocks('float'))  && (("/".variable_get('site_frontpage','node') == request_uri()) || ("/" == request_uri()))) {
    $output .= "<div class=\"blocks-float\">" . str_replace("<div class=\"block","<div class=\"block-float",$blocks) . "</div>\n";
  }

If you don't feel like making the changes yourself, I've attached the modified block.module to this page. I hope all of this helps.

ec’s picture

Joe, thanks for this post that I am also interested in. I'm following everything till

array(t('left'), t('right'), t('float'))

After that, I'm lost.
Does your code run with xtemplate ? where should it put it or could you give some more details ?
Thanks,
Eric

joe@www.joepilot.net’s picture

I'm not sure if it will work with xtemplate. I use a custom theme that takes advantage of this work. My gut instinct is that it will not work with xtemplate since there the xtemplate.theme file has no knowledge of the new block location. The code below the "array" part is in my joepilot_theme function. Please note however that the point of this modification is to allow another block location, not necessarily to create special front page content. It just happens that that is what I use it for. I believe someone else mentioned the frontpage module which is probably better suited to what you want to do. If you still want to do the mods, I can explain in more detail if you wish. Good luck!

sepeck’s picture

I think that there is a front_page module that will allow you to customize all the content of your site's fron page. It may be posible to do it with this.
-sp
---------
Test site...always start with a test site.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

robert castelo’s picture

These are two modules which deal with multiple content columns on a page - see if they suit your purpose...

Collimator
http://drupal.org/node/8153

Sidebar
http://drupal.org/project/sidebar

[MegaGrunt]

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----