1 |
2032
|
Luisehahne
|
//:Load the view.php from any other section-module, including the frontend.css
|
2 |
|
|
//:Use [[iSectionPicker?sid=123]]
|
3 |
|
|
global $database, $wb, $section_id,$page_id,$module;
|
4 |
|
|
$content = '';
|
5 |
|
|
$sid = isset($sid) ? intval($sid) : 0;
|
6 |
|
|
if( $sid ) {
|
7 |
|
|
$oldSid = $section_id; // save old sectionID
|
8 |
|
|
$sql = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` ';
|
9 |
|
|
$sql .= 'WHERE `section_id`='.$sid;
|
10 |
|
|
if (($module = $database->get_one($sql))) {
|
11 |
|
|
if (is_readable(WB_PATH.'/modules/'.$module.'/view.php')) {
|
12 |
|
|
$_sFrontendCss = '/modules/'.$module.'/frontend.css';
|
13 |
|
|
if(is_readable(WB_PATH.$_sFrontendCss)) {
|
14 |
|
|
$_sSearch = preg_quote(WB_URL.'/modules/'.$module.'/frontend.css', '/');
|
15 |
|
|
if(preg_match('/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si', $wb_page_data)) {
|
16 |
|
|
$_sFrontendCss = '';
|
17 |
|
|
}else {
|
18 |
|
|
$_sFrontendCss = '<link href="'.WB_URL.$_sFrontendCss.'" rel="stylesheet" type="text/css" media="screen" />';
|
19 |
|
|
}
|
20 |
|
|
} else { $_sFrontendCss = ''; }
|
21 |
|
|
$section_id = $sid;
|
22 |
|
|
ob_start();
|
23 |
|
|
$sectionAnchor = (defined('SEC_ANCHOR') && SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec';
|
24 |
|
|
echo PHP_EOL.'<div id="'.$sectionAnchor.$sSectionIdPrefix.'" class="section m_'.$module.'" >'.PHP_EOL;
|
25 |
|
|
require(WB_PATH.'/modules/'.$module.'/view.php');
|
26 |
|
|
echo PHP_EOL.'</div><!-- '.$module.$section_id.' -->'.PHP_EOL;
|
27 |
|
|
$content = $_sFrontendCss.ob_get_clean();
|
28 |
|
|
$section_id = $oldSid; // restore old sectionID
|
29 |
|
|
}
|
30 |
|
|
}
|
31 |
|
|
}
|
32 |
|
|
return $content;
|