From 5ccc9e1b8d90969c699d5b6520fd0c720bfcf26c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 27 May 2015 15:21:30 +0200 Subject: make it possible to include menus in blocks - this will only work in html blocks of course --- include/comanche.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/comanche.php') diff --git a/include/comanche.php b/include/comanche.php index 65f64be5c..cb46985eb 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -168,6 +168,21 @@ function comanche_block($s, $class = '') { ); if($r) { + //check for eventual menus in the block and parse them + $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $r[0]['body'] = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $r[0]['body']); + } + } + $cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $r[0]['body'] = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$r[0]['body']); + } + } + + //emit the block $o .= (($var['wrap'] == 'none') ? '' : '
'); if($r[0]['title'] && trim($r[0]['body']) != '$content') { -- cgit v1.2.3