aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-29 20:54:42 -0700
committerfriendica <info@friendica.com>2013-08-29 20:54:42 -0700
commit74582630177b104f35113cee77d2c7ac5f74f412 (patch)
tree031770083dc6e2462e6190b59e6c59c6ea5c0624 /boot.php
parent85e291f5357bc28b108378816af97b545aacca3f (diff)
downloadvolse-hubzilla-74582630177b104f35113cee77d2c7ac5f74f412.tar.gz
volse-hubzilla-74582630177b104f35113cee77d2c7ac5f74f412.tar.bz2
volse-hubzilla-74582630177b104f35113cee77d2c7ac5f74f412.zip
I've got a pretty good idea of how to bootstrap, parse and render Comanche now. This does not mean it's close to being presentable - far from it.
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/boot.php b/boot.php
index a5ff7ea0b..5e8b52d0d 100755
--- a/boot.php
+++ b/boot.php
@@ -2386,6 +2386,7 @@ function get_custom_nav(&$a,$navname) {
function construct_page(&$a) {
+ require_once('include/comanche.php');
$comanche = ((count($a->layout)) ? true : false);
@@ -2434,9 +2435,23 @@ function construct_page(&$a) {
$a->page[$x['location']] .= $x['html'];
}
}
+
+ // Let's say we have a comanche declaration '[region_nav][/region_nav][region_content]$region_nav $region_section[/region_content]'.
+ // The text 'region_' identifies a section of the layout by that name (without the 'region_' text).
+ // So what we want to do here is leave $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
+ // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page
+ // has a '<content>' element instead of a '<section>'.
+
+ // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
+ // layout completely with a new layout definition, or replace/remove existing content.
+
if($comanche) {
foreach($a->layout as $k => $v) {
- if(strpos($k,'region_') === 0) {
+ if((strpos($k,'region_') === 0) && strlen($v)) {
+ if(strpos($v,'$region_') !== false) {
+ $v = preg_replace_callback('/\$region_([a-zA-Z0-9]*?)/ism','comanche_replace_region',$v);
+
+ }
$a->data[substr($k,0,7)] = $v;
}
}