Customizing the Front Page in Drupal
Most of the default Drupal Themes display a simple list of the last 10 entries with pagination if needed.
Some of my first custom front pages involved writing sql and laying out the results within the page-front.tpl. While this worked great and made it easy to control exactly what and where things appear.
But later on when the owner wanted mild changes it required digging back into a complex template file instead of just making alterations from within the Drupal Admin area.
The far better way
On my current site I wanted only two teasers displayed up top [entry][entry] followed by another row containing a last 2 comments block and a tag block [comment][tags] and the final row to contain links to the last 5 links to entries beyond the two teasers shown in the first row also another block position for something later on

I'm using Zen as my base them and added these regions to zen.info
regions[front_top] = front top
regions[front_middleleft] = front middle left block
regions[front_middleright] = front middle right block
regions[front_bottomleft] = front bottom left
regions[front_bottomright] = front bottom right
Flush the theme registry cache and within the admin >> build >> block >> list the regions should appear.
Now in my page-front.tpl I use the variables
$front_top
$front_middleleft
$front_middleright
$front_bottomleft
$front_bottomright
To display these regions.
Using views create block display views for each block I want and back to the block list area to assign these. Add some css to improve the layout a bit. (I haven't tested mine in anything but firefox yet)
Now instead of having to alter the layout I can just edit the blocks and views to control the front page.

Comments
Post new comment