From 2f222546da869b904f076ec17e785470b06af770 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 12 May 2016 21:18:34 -0700 Subject: Comanche: provide a variable '$region' which can be used within a layout to make content aware of where it is on the page. For instance this can be passed as a variable to a widget and trigger either a vertical or horizontal layout depending on which region it is assigned to. --- Zotlabs/Render/Comanche.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Render') diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index 776874e35..1017ec6aa 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -8,7 +8,6 @@ require_once('include/widgets.php'); - class Comanche { @@ -95,7 +94,7 @@ class Comanche { $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - \App::$layout['region_' . $mtch[1]] = $this->region($mtch[2]); + \App::$layout['region_' . $mtch[1]] = $this->region($mtch[2],$mtch[1]); } } } @@ -320,7 +319,9 @@ class Comanche { } - function region($s) { + function region($s,$region_name) { + + $s = str_replace('$region',$region_name,$s); $matches = array(); -- cgit v1.2.3