+
+function get_text_between($text, $start_text, $end_text) {
+ $start = strpos($text, $start_text);
+ if($start === false) {
+ return false;
+ }
+ $text = substr($text, $start + strlen($start_text));
+ $end = strpos($text, $end_text);
+ if($end === false) {
+ return false;
+ }
+ return substr($text, 0, $end);
+}
+
+# Make it easy to insert an array into the template data structure so that each
+# element of the array gets its own row.
+#
+# passed this: columnate(array('a', 'b', 'c'), 'k');
+# it returns: array(array('k' => 'a'),
+# array('k' => 'b'),
+# array('k' => 'c'));
+# passed this: columnate(array(), 'k');
+# it returns: false
+function columnize($arr, $key = 'data') {
+ if(!$arr) {
+ return false;
+ }
+ $ret = array();
+ foreach($arr as $val) {
+ $ret[] = array($key => $val);
+ }
+ return $ret;
+}
+