<?php require "lib.htmlgen.php"; h::set_variable("table_data", array("foo" => "bar", "hello" => "world", "123" => "456", "abc" => "xyz")); h::set_indent_pattern(" "); h::html(function () { h::head(function () { h::meta(array("charset" => "UTF-8")); h::link(array("rel" => "stylesheet", "type" => "text/css", "href" => "global.css")); }); h::body(function () { h::div(array("id" => "wrapper"), function () { h::h1("Hello, World", array("class" => "title")); h::comment("navigation"); h::ul(array("class" => "links"), function () { foreach (array(1, 2, 3) as $x) { h::li(function () use($x) { h::a("Link {$x}", "#{$x}"); }); } }); h::comment("let's see some text"); h::p("Lorem ipsum dolor sit amet, consectetur adipisicing elit..."); h::comment("now for a table"); h::table(function () { $table_data = h::get_variable('table_data', array()); h::tr(array("class" => "header"), function () { h::th("key"); h::th("value"); }); foreach ($table_data as $k => $v) {
public function toHtml(array $params = array(), array $innerCallbacks = array()) { require_once 'lib/lib.htmlgen.php'; h::set_indent_pattern(' '); $o = $this; /* h::div(array('class' => 'builderElement'), function() use ($o) { h::div(array('class' => 'builderElementTitle'), 'Project'); h::div(array('class' => 'builderElementForm'), function() { h::form(array('id' => '', 'action' => UrlManager::getForAjaxProjectIntegrationBuilderSaveElement()), function() use ($o) { // Name, textfield h::div(array('class' => 'label'), 'Name'); h::div(array('class' => 'textfieldContainer'), function() use ($o) { h::input(array('class' => 'textfield', 'type' => 'text', 'name' => 'project', 'value' => $o->getName())); }); // Basedir, textfield h::div(array('class' => 'label'), 'Basedir'); h::div(array('class' => 'textfieldContainer'), function() use ($o) { h::input(array('class' => 'textfield', 'type' => 'text', 'name' => 'baseDir', 'value' => $o->getBaseDir())); }); // Default target, textfield h::div(array('class' => 'label'), 'Default target'); h::div(array('class' => 'textfieldContainer'), function() use ($o) { h::input(array('class' => 'textfield', 'type' => 'text', 'name' => 'defaultTarget', 'value' => $o->getDefaultTarget())); }); // TODO: Properties, with support for "add more" automatically h::div(array('class' => 'label'), 'Basedir'); h::div(array('class' => 'textfieldContainer'), function() use ($o) { h::input(array('class' => 'textfield', 'type' => 'text', 'name' => 'baseDir', 'value' => $o->getBaseDir())); }); }); }); });*/ //h::form(array('id' => '', 'action' => UrlManager::getForAjaxProjectIntegrationBuilderSaveElement()), function() use ($o) { if ($o->getTargets()) { $targets = $o->getTargets(); foreach ($targets as $target) { $target->toHtml(); } } //h::input(array('type' => 'submit', 'value' => 'Save all!', 'id' => 'submitButton')); //}); }