Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 1106)
+++ trunk/CHANGELOG	(revision 1107)
@@ -12,6 +12,8 @@
 
 ------------------------------------- 2.8.0 -------------------------------------
 6-Aug-2009 Matthias Gallas
+#	Fixed bug that frontend.js, frontend.css and frontend_body.js are not used
+	from snippets (ticket #764) (Thanks to Luisehahne)
 +	Added new function 'register_frontend_modfiles_body' to default templates
 +	Added option to use a frontend_body.js in modules to include javascript from modules
 	in the body of the frontend (Thanks to Luisehahne)
Index: trunk/wb/framework/frontend.functions.php
===================================================================
--- trunk/wb/framework/frontend.functions.php	(revision 1106)
+++ trunk/wb/framework/frontend.functions.php	(revision 1107)
@@ -47,6 +47,10 @@
 $extra_sql=&$wb->extra_sql;
 $extra_where_sql=&$wb->extra_where_sql;
 
+$include_head_link_css = '';
+$include_body_links = '';
+$include_head_links = '';
+
 $query="SELECT directory FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'snippet'";
 $query_result=$database->query($query);
 if ($query_result->numRows()>0) {
@@ -54,6 +58,23 @@
 		$module_dir = $row['directory'];
 		if (file_exists(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
 			include(WB_PATH.'/modules/'.$module_dir.'/include.php');
+			/* check if frontend.css file needs to be included into the <head></head> of index.php
+			*/
+			if( file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
+				$include_head_link_css .= '<link href="'.WB_URL.'/modules/'.$module_dir.'/frontend.css"';
+				$include_head_link_css .= ' rel="stylesheet" type="text/css" media="screen" />'."\n";
+				$include_head_file = 'frontend.css';
+			}
+			// check if frontend.js file needs to be included into the <body></body> of index.php
+			if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
+				$include_head_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend.js" type="text/javascript"></script>'."\n";
+				$include_head_file = 'frontend.js';
+			}
+			// check if frontend_body.js file needs to be included into the <body></body> of index.php
+			if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
+				$include_body_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend_body.js" type="text/javascript"></script>'."\n";
+				$include_body_file = 'frontend_body.js';
+			}
 		}
 	}
 }
@@ -334,12 +355,19 @@
 			return;
 		}
 
-		global $wb, $database;
+		global $wb, $database, $include_body_links;
 		// define default baselink and filename for optional module javascript files
 		$body_links = "";
-        $base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend_body.js" type="text/javascript"></script>';
-        $base_file = "frontend_body.js";
+		$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend_body.js" type="text/javascript"></script>';
+		$base_file = "frontend_body.js";
 
+		if(!empty($include_body_links)) {
+			if(strpos($body_links, $include_body_links) === false) {
+				$body_links .= $include_body_links;
+			}
+			$include_body_links = '';
+		}
+
 		// gather information for all models embedded on actual page
 		$page_id = $wb->page_id;
 		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
@@ -371,6 +399,7 @@
 	}
 }
 
+
 // Function to add optional module Javascript or CSS stylesheets into the <head> section of the frontend
 if(!function_exists('register_frontend_modfiles')) {
 	function register_frontend_modfiles($file_id="css") {
@@ -380,9 +409,10 @@
 			return;
 		}
 
-		global $wb, $database;
+		global $wb, $database, $include_head_link_css, $include_head_links;
 		// define default baselink and filename for optional module javascript and stylesheet files
 		$head_links = "";
+
 		if($file_id == "css") {
 			$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
 			$base_link.= ' rel="stylesheet" type="text/css" media="screen" />';
@@ -392,6 +422,20 @@
 			$base_file = "frontend.js";
 		}
 
+		if(!empty($include_head_link_css)) {
+			if(strpos($head_links, $include_head_link_css) === false) {
+				$head_links .= $include_head_link_css;
+			}
+			$include_head_link_css = '';
+		} else {
+			if(!empty($include_head_links)) {
+				if(strpos($head_links, $include_head_links) === false) {
+					$head_links .= $include_head_links;
+				}
+				$include_head_links = '';
+			}
+		}
+
 		// gather information for all models embedded on actual page
 		$page_id = $wb->page_id;
 		$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections 
