diff options
author | friendica <info@friendica.com> | 2013-09-04 21:24:57 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-09-04 21:24:57 -0700 |
commit | 99ea251b12f9bf361daf8abd96f6b3fab7023aa7 (patch) | |
tree | 50e778441b56c7dea0168941d11622079e308b5e /include/comanche.php | |
parent | ba283028118c6ad7af9d9ba3586f2f55a10e5cb8 (diff) | |
download | volse-hubzilla-99ea251b12f9bf361daf8abd96f6b3fab7023aa7.tar.gz volse-hubzilla-99ea251b12f9bf361daf8abd96f6b3fab7023aa7.tar.bz2 volse-hubzilla-99ea251b12f9bf361daf8abd96f6b3fab7023aa7.zip |
provide templating options in comanche for the underlying webpage element - in this case the way the author is displayed. Leave this open for other forms templating options.
Diffstat (limited to 'include/comanche.php')
-rw-r--r-- | include/comanche.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/comanche.php b/include/comanche.php index c3a513332..56a16fd3b 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -60,6 +60,14 @@ function comanche_parser(&$a,$s) { } } + $cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + // only the last webpage definition is used if there is more than one + foreach($matches as $mtch) { + $a->layout['webpage'] = comanche_webpage($a,$mtch[1]); + } + } + } @@ -92,6 +100,25 @@ function comanche_block($name) { return $o; } +// This doesn't really belong in Comanche, but it could also be argued that it is the perfect place. +// We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content. +// For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps +// 'full' to provide a social network style profile photo. +// But leave it open to have richer templating options and perhaps ultimately discard this one, once we have a better idea +// of what template and webpage options we might desire. + +function comanche_webpage(&$a,$s) { + + $ret = array(); + $cnt = preg_match_all("/\[authored\](.*?)\[\/authored\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $ret['authored'] = $mtch[1]; + } + } + return $ret; +} + // Widgets will have to get any operational arguments from the session, // the global app environment, or config storage until we implement argument passing |