have a primary and secondary front page - useful for flash or splash graphic front pages

description

This describes how to have a flash or splash graphic front page to your site and a "regular" front page.

dependancies

This is intended for use with the front_page.module

Step 1 of 1

  1. Go to ADMINISTER -> SETTINGS -> FRONT_PAGE
  2. In the text area for your front page for ANONYMOUS USERS, paste in the following snippet
  3. Select the ALLOW PHP IN PAGE option and set to FULL PAGE so your splash flash fills the screen
  4. Edit the snippet (example.com) to match your site
  5. Paste in your Splash/Flash HTML code in the place provided
  6. Save settings.

<?php

/**
* Change the $yoursite value to your website address
*/

$yoursite = "example.com";

/**
* paste your flashsplash HTML content in between the quote marks in the next line.
* It can run as many lines as you want as long as it begins and ends
* with the quotemarks.
*/
$flashsplashcode = 'paste your flashsplash HTML code here';

/**
* check to see where the visitor is coming from
*
*/

$ref = $_SERVER["HTTP_REFERER"];

    if  (!
stristr($ref, "$yoursite"))  {

   
//Offsite referrer detected so display the full splash/flash page.
   
print $flashsplashcode;
    }

  else {
/**
* This php snippet displays the 10 most recent weblog entries with
* teaser & info.
*/
 
$listlength=10; //determines the amount of weblog entries displayed. increase or decrease to suit.
 
$result1 = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), $listlength);
  while (
$node = db_fetch_object($result1)) {
   
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
  }
print
theme('page', $output); // displays the output as a themed page to include the mission.
}
?>

Notes

  • It's generally considered to be bad design to have flash/splash page for your site. But I can see where some sites, e.g. adult sites, might want to display a strong warning.
  • Please post tips/tricks discuss this handbook page at this thread.
  • There are a lot of other useful content snippets in the HANDBOOK -> PHP SNIPPETS -> PHP PAGE SNIPPETS if you want to display something other than the 10 most recent weblog entries
 
 

Drupal is a registered trademark of Dries Buytaert.