All pastes #27901 Raw Edit

jinexile

public php v1 · immutable
#27901 ·published 2005-11-07 20:23 UTC
rendered paste body
Website.php://in the class variable declarations add:var $module_javascript = array();var $module_css = array();//Modified display_header() function	function display_header()	{		$head='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>	<title>'.remove_html($this->site_name).'</title>	<meta http-equiv="Content-Type" content="text/html; charset='.MSG_charactereEncoding.'" />	<meta name="author" content="'.remove_html($this->site_author).'" />	<meta name="keywords" content="'.remove_html($this->meta).'" />	<link rel="stylesheet" type="text/css" media="screen" href="themes/'.$this->theme.'/'.$this->theme.'.css" />	<script type="text/javascript" src="functions/formulaire_news.js" />	<!-- Module defined headers -->';		if(count($this->module_javascript)!=0){			foreach($this->module_javascript as $js){				$head.="\n\t<script type=\"text/javascript\" src=\"".$js."\" />";			}		}		if(count($this->module_css)!=0){			foreach($this->module_css as $css){				$head.="\n\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"".$css."\" />";			}		}	$head.="\n</head>\n";		$fp=fopen("themes/".$this->theme."/header.html","r");		$display=fread($fp,8192);		//$display=$this->replace_block($display);		$display=$this->replace_keyword($display);		echo $head.$display;		echo $this->display_block(1);		echo $this->display_block(2);		echo'<div id="module_content" class="'.$this->return_class().'">';	}//Add add_header() function to website class:	function add_header($type){		$dir="modules/".$this->module."/".$type;		if(is_dir($dir)){			if($handle = opendir($dir)){				while(false !== ($file=readdir($handle))){					if ($file != "." && $file != ".."){						switch(type){							case "javascript":								array_push($this->module_javascript,$file);								break;							case "css":								array_push($this->module_css,$file);								break;						}					}				}			}		}	}//at the end of the include_module() function add the following:add_header("javascript");add_header("css");/* Now with any module you want to add custom css or javascript to all you need to do is add the folder "javascript" or "css" and any files you put into them will be linked appropriatly in the header of the html. */