Index: trunk/wb/framework/class.frontend.php
===================================================================
--- trunk/wb/framework/class.frontend.php	(revision 50)
+++ trunk/wb/framework/class.frontend.php	(revision 51)
@@ -38,7 +38,10 @@
 
 class frontend extends wb {
 	// defaults
-	var	$default_link,$default_page_id;
+	var $default_link,$default_page_id;
+	// when multiple blocks are used, show home page blocks on 
+	// pages where no content is defined (search, login, ...)
+	var $no_default_content=false;
 
 	// page details
 	// page database row
@@ -90,7 +93,7 @@
 			if($default_num_rows > 0) {
 				$fetch_default = $get_default->fetchRow();
 				$this->default_link = $fetch_default['link'];
-				$default_page_id = $fetch_default['page_id'];
+				$this->default_page_id = $fetch_default['page_id'];
 				// Check if we should redirect or include page inline
 				if(HOMEPAGE_REDIRECTION) {
 					// Redirect to page
@@ -98,7 +101,7 @@
 					exit();
 				} else {
 					// Include page inline
-					$this->page_id = $default_page_id;
+					$this->page_id = $this->default_page_id;
 				}
 			} else {
 		   		// No pages have been added, so print under construction page
@@ -111,7 +114,8 @@
 		// Get default page link
 		if(!isset($fetch_default)) {
 		  	$fetch_default = $get_default->fetchRow();
-	 		$this->default_link = $fetch_default['link'];
+	 		$this->default_link = $fetch_default['link'];
+			$this->default_page_id = $fetch_default['page_id'];
 		}
 		return true;
 	}
@@ -416,11 +420,19 @@
 		}
 		if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
 		// Make sure block is numeric
-		if(!is_numeric($block)) { $block = 1; }
+		if(!is_numeric($block)) { $block = 1; }
 		// Include page content
-		if(!defined('PAGE_CONTENT') OR $block!=1) {
+		if(!defined('PAGE_CONTENT') OR $block!=1) {
+			if ($this->page_id==0) {
+				if ($block != 1 AND $this->no_default_content==true) {
+					return;
+				}
+				$page_id=$this->default_page_id;
+			} else {
+				$page_id=$this->page_id;
+			}
 			// First get all sections for this page
-			$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".PAGE_ID."' AND block = '$block' ORDER BY position");
+			$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
 			if($query_sections->numRows() > 0) {
 				// Loop through them and include there modules file
 				while($section = $query_sections->fetchRow()) {
@@ -430,7 +442,9 @@
 				}
 			}
 		} else {
-			require(PAGE_CONTENT);
+			if($block == 1) {
+				require(PAGE_CONTENT);
+			}
 		}
 	}
 
