diff options
author | friendica <info@friendica.com> | 2013-09-04 00:50:47 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-09-04 00:50:47 -0700 |
commit | a8f99df7770e6154ac4e0bc405974fde22357af6 (patch) | |
tree | 2d4f6e3fca51e0ca5ad249f02736c28123617b58 | |
parent | a0668c8bbba43cb8b3b28d5a75d7d48f321e30f5 (diff) | |
download | volse-hubzilla-a8f99df7770e6154ac4e0bc405974fde22357af6.tar.gz volse-hubzilla-a8f99df7770e6154ac4e0bc405974fde22357af6.tar.bz2 volse-hubzilla-a8f99df7770e6154ac4e0bc405974fde22357af6.zip |
render blocks - yes these should be templates, but I've got too much to do at the moment and just want everything to fall into place quickly. The clerical work will have to wait.
-rw-r--r-- | include/comanche.php | 23 | ||||
-rw-r--r-- | version.inc | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/include/comanche.php b/include/comanche.php index 3b50a5d85..c3a513332 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -76,6 +76,23 @@ function comanche_replace_region($match) { } } +function comanche_block($name) { + $o = ''; + $r = q("select * from item left join item_id on iid = item_id and item_id.uid = item.uid and service = 'BUILDBLOCK' and sid = '%s' limit 1", + dbesc($name) + ); + if($r) { + $o = '<div class="widget bblock">'; + if($r[0]['title']) + $o .= '<h3>' . $r[0]['title'] . '</h3>'; + $o .= prepare_text($r[0]['body'],$r[0]['mimetype']); + $o .= '</div>'; + + } + return $o; +} + + // Widgets will have to get any operational arguments from the session, // the global app environment, or config storage until we implement argument passing @@ -97,6 +114,12 @@ function comanche_region(&$a,$s) { $s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s); } } + $cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_block(trim($mtch[1])),$s); + } + } // need to modify this to accept parameters diff --git a/version.inc b/version.inc index a0e566714..5c930aad3 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-09-03.425 +2013-09-04.426 |