Ejemplo n.º 1
0
<?php

/**
 * Example: Create a div element with an id attribute and value.
 * 
 */
require_once dirname(__FILE__) . '/../../library/FabricationEngine.php';
$engine = new Fabrication\FabricationEngine();
# Create DOM Element of the type div with an id attribute with the value of hello-world.
$hi = $engine->create('div', 'Hello', ['id' => 'hello']);
# Render the element.
$helloText = $hi->ownerDocument->saveXML($hi);
# Append to the engine and view the html structure
$engine->appendChild($hi);
$engine->input('#hello', 'world');
echo $engine->saveHTML();
Ejemplo n.º 2
0
<?php

require dirname(__FILE__) . '/../../library/FabricationEngine.php';
$engine = new \Fabrication\FabricationEngine();
$engine->input('#greeting', $engine->create('div', 'World'));
$template = '<html><head></head><body><div id="greeting">Hello</div></body></html>';
$engine->run($template);
var_dump($engine->saveHTML());
Ejemplo n.º 3
0
<?php

/**
 * Example: Create a div element with an id attribute and value.
 * with children recursively.
 * 
 */
require_once dirname(__FILE__) . '/../../library/FabricationEngine.php';
$engine = new Fabrication\FabricationEngine();
$hi = $engine->create('div', '', array('id' => 'hello-world'), array(array('name' => 'u', 'value' => 'Hello', 'attributes' => array('id' => 'hello'), 'children' => array()), array('name' => 'strong', 'attributes' => array('id' => 'world'), 'children' => array(array('name' => 'i', 'value' => 'W'), array('name' => 'i', 'value' => 'o'), array('name' => 'i', 'value' => 'r'), array('name' => 'i', 'value' => 'l'), array('name' => 'i', 'value' => 'd')))));
$engine->appendChild($hi);
echo $engine->saveHTML();