]> git.sesse.net Git - xml-template/blobdiff - php5-swig/xml-template.php
Add a proper wrapper for php5-swig, which also makes attribute[23] pass. All tests...
[xml-template] / php5-swig / xml-template.php
diff --git a/php5-swig/xml-template.php b/php5-swig/xml-template.php
new file mode 100644 (file)
index 0000000..289b9c7
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+include("XML_Template_SWIG.php");
+
+# FIXME: use varargs here
+function XML_Template_alternate($tag, $array, $elems)
+{
+       $num = count($elems);
+
+       for ($i = 0, $j = 0; $i < count($array); $i++) {
+               if (isset($array[$i])) {
+                       $array[$i][$tag] = $elems[$j++ % $num];
+               }
+       }
+
+       return $array;
+}
+?>