Project

General

Profile

1
//:Load the view.php from any other section-module
2
//:Use [[SectionPicker?sid=123]]
3
global $database, $wb, $TEXT, $DGTEXT;
4
$content = '';
5
if( intval($sid)>0 ) {
6
	$sql  = 'SELECT `page_id`, `section_id`, `module` FROM `'.TABLE_PREFIX.'sections` ';
7
	$sql .= 'WHERE `section_id` = '.(int)$sid;
8
	$sql .= '';
9
	if($query_sec = $database->query($sql))
10
	{
11
		$section = $query_sec->fetchRow();
12
		$section_id = $section['section_id'];
13
		$module = $section['module'];
14
		$_sFrontendCss = '/modules/'.$module.'/frontend.css';
15
		if(is_readable(WB_PATH.$_sFrontendCss)) {
16
			$_sSearch = preg_quote(WB_URL.'/modules/'.$module.'/frontend.css', '/');
17
			if(preg_match('/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si', $wb_page_data)) {
18
				$_sFrontendCss = '';
19
			}else {
20
				$_sFrontendCss = '<link href="'.WB_URL.$_sFrontendCss.'" rel="stylesheet" type="text/css" media="screen" />';
21
			}
22
		}
23
		ob_start();
24
		require(WB_PATH.'/modules/'.$module.'/view.php');
25
		$content = $_sFrontendCss.ob_get_clean();
26
	}
27
}
28
return $content;
(11-11/16)