Drupal Articles » Drupal home page creation techniques » Analysis of DrupalSN.com home page
I posted this originally in the Learning Drupal section of DrupalSN.com, though re-posting here for the people learning at my site. Here's my analysis of how DrupalSN.com's home page is likely put together. I'm sure Tom (the owner of DrupalSN) can fill in a few blanks, but I'm relatively sure this is very close to how it works :)
- My guess is that there is a custom CCK type called something like "Section", which includes the usual Title and Body, and also has a custom "section_subtitle" field. This field is where the text "DruaplSN is a Drupal community..." under the main title of the home page comes from. So that you have clear paths to use for setting blocks to appear at the URL of specific Sections, Pathauto module should be configured to give a path of [title-raw] for Section nodes to create paths like example.com/section-name (or [menupath-raw] if your Sections will be located in sub-sections of your menu, so you will create paths such as example.com/firstlevel/section-name in that case).
- The home page is a single Section node, which I believe has a blank Body. To make this particular node the front/home page, its path is set in the "Default front page" option at /admin/settings/site-information (e.g. either node/# or the clean URL path such as home or whatever it may be).
- The rest of the page is broken into 2 primary sections, one that fills the wider left side, and another for the right sidebar. In the left side of the template there are probably 3 Drupal Regions (the first and third could be called differently, but these are the "usual" names in many themes).
Regions of the left column
$content_top (where blocks could be assigned to have them appear "above" the Body content of the node, if there is any. There are no blocks assigned here for the front page. This region may not be included if the site had no use for it).
$content (the standard $content variable responsible for printing out essentially all content of every page in Drupal, whatever it may be given the current page being viewed. Since in this particular case there is nothing for Drupal to print on this page, it returns some div tags but no visible content).
$content_bottom (where blocks could be assigned to have them appear "below" the Body content of the node, if there is any. In the case of the Home page, there is nothing in $content_top, and $content is visually empty since the Body of the node is empty. $content_bottom on the other hand has at least 4 separate blocks assigned to it, and set to display only on the <front> path).
Most of the blocks are generated by Views module, and in most cases using a "Field" row style, not nodes.
- The first "slideshow-like" View block uses a slideshow plugin module for Views, probably Views Rotator module.
- The "Latest Projects" block is a standard Views listing of fields from nodes (likely a CCK type called "Project")... fields used include ImageFields (sized with ImageCache), titles, user names, and Fivestar module ratings (showing Fivestar ratings like this in Views 2 is evidently slightly tricky to understand, so here's a video guide). Every block's title heading has a bit of jQuery to toggle it open and closed if desired (here's a good guide on toggling visibility using jQuery).
- Next there is the "Learn Drupal" set of 3 more Views-created blocks, which are shown together in a single unit as tabs using the Quicktabs module.
- There are two final blocks in the left column, "Drupal News" (generated by Views) and "Recent comments" (the Recent comments block that comes with Drupal core, possibly with some extra theming to add in the user pictures). These two blocks are shown side by side because each is contained in a separate Div with a specific CSS class: .floatleft on the left block and .floatright on the right block, which sets each to 49% width and floats the block either left or right respectively. The extra 2% is the padding between the two blocks.
Region for the right sidebar/column
The rest of the page is the Sidebar Right region (in Drupal 5 this is $sidebar_right, while in Drupal 6 this is called $right):
- First there is a block which contains two image banners, "New to Drupal?" and "Looking to hire a Drupaler?" This block is set to display only on the
<front>page, since the sidebar is less wide on the home page versus other pages (so a different block is likely used for other pages with these banners. - Next there is a "Who's New" block which is generated by Views and set to display only on
<front>. On this Drupal 5 site, this View lists User nodes, however with version 2 of Views in Drupal 6, it is now possible to list usernames and pictures in this way without User nodes. - Next there is the "User status updates" block, which is created (I believe) by the Facebook-style Status module.
- The "Recent logins" block is generated by Views.
- Lastly there is the AdSense block, which is created by the AdSense module. This particular AdSense block is limited to display only on the
<front>page.
Hope this helps :)
