From 6e1365d9774efa69219c4d68d58256f0e6f875b6 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 4 Oct 2006 03:10:49 +0200 Subject: [PATCH] Make PHP pass attribute3. --- php/xml-template.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/php/xml-template.php b/php/xml-template.php index a0c6507..6fbf4bf 100644 --- a/php/xml-template.php +++ b/php/xml-template.php @@ -81,6 +81,10 @@ function XML_Template_process($node, $obj, $clean = 1) } foreach ($obj as $instance) { + if (!isset($instance)) { + continue; + } + $newnode = own_clone_node($frag, $frag->owner_document()); $node->append_child($newnode); XML_Template_process($newnode, $instance, $clean); @@ -131,8 +135,10 @@ function XML_Template_alternate($tag, $array, $elems) { $num = count($elems); - for ($i = 0; $i < count($array); $i++) { - $array[$i][$tag] = $elems[$i % $num]; + for ($i = 0, $j = 0; $i < count($array); $i++) { + if (isset($array[$i])) { + $array[$i][$tag] = $elems[$j++ % $num]; + } } return $array; -- 2.39.2