コード例 #1
0
ファイル: genhtml-fromArray.php プロジェクト: annggeel/tienda
<?php

/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
require_once './minixml.inc.php';
$t1NumRows = 3;
$t1NumCols = 3;
$t2NumRows = 2;
$t2NumCols = 2;
$htmlDoc = new MiniXMLDoc();
$htmlArray = array('html' => array('head' => array('title' => 'XML::Mini Generated HTML page', 'style' => 'body,td,a,p,.harray(font-family:arial,sans-serif;) .qarray(text-decoration:none; color:#0000cc;)'), 'body' => array('bgcolor' => '#ffffff', 'link' => '#0000cc', 'vlink' => '#551a8b', 'h3' => 'This page was generated by XML::Mini!', 'p' => array(array('-content' => 'View the source of this page to take a look at', 'a' => array('href' => 'http://minixml.psychogenic.com', '-content' => 'XML::Mini')), array('font' => array('size' => '-1', 'color' => '#3333cc', '-content' => 'The table below was generated with php - hooray.')), array('align' => 'center', 'table' => array('cellpadding' => 5)), array('align' => 'left', '-content' => '============================', 'table' => array('width' => '75%', 'align' => 'center', 'tr' => array(array('td' => array('b' => "And here is the output of \$htmlDoc->getValue()", 'br' => '', '-content' => $htmlDoc->getValue())))))))));
# end of hash
$options = array('attributes' => array('body' => array('bgcolor', 'link', 'vlink'), '-all' => array('align', 'color'), 'a' => 'href', 'font' => 'size', 'table' => array('cellpadding', 'cellspacing')));
$htmlDoc->fromArray($htmlArray, $options);
print $htmlDoc->toString();
コード例 #2
0
ファイル: fromArray.php プロジェクト: stepheneb/test-from-svn
<?php

header("Content-type: text/plain\r\n\r\n");
require_once './minixml.inc.php';
$xmlDoc = new MiniXMLDoc();
$xmlStructure = array("spies" => array("spy" => array(array('id' => '007', 'type' => 'SuperSpy', 'name' => 'James Bond', 'email' => '*****@*****.**', 'address' => 'Wherever he is needed most'), array('id' => '6', 'type' => 'RetiredSpy', 'name' => 'Number 6', 'email' => array('type' => 'private', '-content' => '*****@*****.**', 'location' => 'office'), 'address' => '123 Island Prison Lane'), array('name' => 'Inspector Gadget', 'id' => '13', 'type' => 'NotReallyASpy', 'email' => '*****@*****.**', 'friends' => array('friend' => array(array('name' => array('first' => 'little', 'last' => 'girl'), 'age' => 12, 'hair' => array('color' => 'brown', 'length' => 'long')), array('name' => array('first' => 'smelly', 'last' => 'dog'), 'age' => 14, 'hair' => array('color' => 'dirtry blond', 'length' => 'short'))))))));
$arrayOptions = array('attributes' => array('-all' => array('type', 'color'), 'spy' => 'id', 'email' => array('location'), 'hair' => 'length'));
$xmlDoc->fromArray($xmlStructure, $arrayOptions);
print "\n\n\nParsed ARRAY looks like this:\n";
var_dump($xmlDoc->toArray());
print "\n\nOUTPUT of fromArray() *with* OPTIONAL 'attributes' options set (for spy:id, email:location, hair:length, type, color)\n";
print $xmlDoc->toString();