Lightweight Drupal home page

I’ve cleaned up my code for MacMegasite’s new page by breaking it up into separate include files for the left & right sidebars. The entire code is less than 50 lines and uses only a single database query and no calls to Drupal code.

Here’s the full code, not including the style sheet and sidebar content:

<html>
<head>
<meta http-equiv=content-type content="text/html; charset=utf-8">
<title>MacMegasite</title>
<style type="text/css" title="text/css">
<!--
@import url(INC/style.css);
-->
</style>
</head>
<body>
<img src="INC/logo.gif" class=logo>
<br>

<div class="left">
<?php include "INC/left.inc" ?>
</div>

<div class="right">
<?php include "INC/right.inc" ?>
</div>

<table class=content>
<?php
$dbname="your_database_name";
$host="your_host_name";
$user="your_user_name";
$pass="your_password";

$dbi = mysql_connect($host,$user,$pass);
mysql_select_db($dbname);

$query = "select nid, title, teaser from node where status=1 and promote=1 order by nid desc limit 10";
$res = mysql_query($query,$dbi);
while (list($nid,$title,$teaser) = mysql_fetch_row($res)) {
   print "<tr><td>";
   print "<h1><a href='http://www.macmegasite.com/drupal/node/".$nid."'>".$title."</a></h1>\n";
   print $teaser;
   print "<hr width=75% align=center><br>\n</td></tr>\n";
}
?>
</table>

</body>
</html>

One response to “Lightweight Drupal home page

  1. I'm really interested in the sidebar "breakouts" you've done. I've been banging my head against a wall trying to work out a hack to display only the left sidebar of my drupal site for smoother integration with a forum package. I'd appreciate your posting the steps/code you took/wrote to achive this.

    Kind regards,
    Leo