<?php
-
-dl("XML_Template_SWIG.so");
+include("xml-template.php");
# NULL values are ignored, but having one helps pointing out that
# the array given is non-associative
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/clone.xml', array(
'color' => 'red',
'#things' => array(
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/clone.xml', array(
'color' => 'blue',
'#things' => XML_Template_alternate('li/class', array(
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/clone.xml', array(
'color' => 'blue',
'#things' => XML_Template_alternate('li/class', array(
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/clone.xml', array(
'color' => 'blue',
'#things' => array(
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/included.xml', array(
'color' => 'red'
), false);
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/namespace.xml', array(
'title' => 'Namespace tests',
'#hello' => 'Hello world!',
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/namespace2.xml', array(
'title' => 'Namespace tests',
'#hello' => 'Replaced.',
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/passthru.xml', array(), true);
output_to_fd($doc, 1);
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/simple.xml', array(
'title' => 'A very basic example',
'#hello' => 'Hello world!'
<?php
+include("xml-template.php");
-dl("XML_Template_SWIG.so");
$doc = XML_Template_process_file('../xml/structure.xml', array(
'#outer' => array(
array( '#inner' => 'One' ),
--- /dev/null
+<?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;
+}
+?>