$fragment->append_child(new AnewtXHTMLHeader2('Forms')); $form = new AnewtXHTMLForm(null, array('method' => 'GET')); $input_fragment = new AnewtXHTMLFragment(); $input_fragment->append_child(new AnewtXHTMLLabel('Label: ', array('for' => 'test'))); $input_fragment->append_child(new AnewtXHTMLInput(null, array('name' => 'test', 'id' => 'test', 'type' => 'text'))); $form->append_child(new AnewtXHTMLParagraph($input_fragment)); $select = new AnewtXHTMLSelect(null, array('name' => 'select')); $select->append_child(new AnewtXHTMLOption('First', array('value' => 'first'))); $select->append_child(new AnewtXHTMLOption('Second', array('value' => 'second'))); $select->append_child(new AnewtXHTMLOption('Third', array('value' => 'third'))); $form->append_child(new AnewtXHTMLParagraph($select)); $fragment->append_child($form); $form->append_child(new AnewtXHTMLParagraph(new AnewtXHTMLInput(null, array('type' => 'submit')))); /* Convenience API */ $r = array(); $r[] = ax_h2('Convenience API'); $r[] = ax_p('Test with some <& special characters.', array('style' => 'color: #ccc;')); $r[] = ax_p_class(ax_raw('This is <strong>strong</strong>'), 'someclass'); $r[] = ax_p(ax_abbr('ICE', 'InterCity Express')); $r[] = ax_p(array('Test', ax_br(), 'after the break')); $p = ax_p(array('testje', array('1', '2'), ax_strong('blablabla'))); $p->set_attribute('id', 'paragraph-id'); $p->set_class('foo bar baz'); $p->remove_class('bar'); $p->add_class('quux'); $p->append_child(ax_a_href('name', '/url/')); $r[] = $p; $r[] = ax_p(ax_sprintf('%s & %s', ax_span_class('Sugar', 'sweet'), 'Spice')); $fragment->append_child(ax_fragment($r, ax_p('final paragraph'))); /* Final output */ echo to_string($fragment), NL;
$select->append_child(new AnewtXHTMLOption('Second', array('value' => 'second'))); $select->append_child(new AnewtXHTMLOption('Third', array('value' => 'third'))); $form->append_child(new AnewtXHTMLParagraph($select)); $fragment->append_child($form); $form->append_child(new AnewtXHTMLParagraph(new AnewtXHTMLInput(null, array('type' => 'submit')))); /* Convenience API */ $r = array(); $r[] = ax_h2('Convenience API'); $r[] = ax_p('Test with some <& special characters.', array('style' => 'color: #ccc;')); $r[] = ax_p_class(ax_raw('This is <strong>strong</strong>'), 'someclass'); $r[] = ax_p(ax_abbr('ICE', 'InterCity Express')); $r[] = ax_p(array('Test', ax_br(), 'after the break')); $p = ax_p(array('testje', array('1', '2'), ax_strong('blablabla'))); $p->set_attribute('id', 'paragraph-id'); $p->set_class('foo bar baz'); $p->remove_class('bar'); $p->add_class('quux'); $p->append_child(ax_a_href('name', '/url/')); $r[] = $p; $r[] = ax_p(ax_sprintf('%s & %s', ax_span_class('Sugar', 'sweet'), 'Spice')); $r[] = ax_p(ax_vsprintf('%s & %s', array(ax_span_class('Sugar', 'sweet'), 'Spice'))); $values = array('this', ax_strong('is'), 'a', ax_span('test')); $r[] = ax_p(ax_join(', ', $values)); $r[] = ax_p(ax_join(ax_em(' & '), $values)); $fragment->append_child(ax_fragment($r, ax_p('final paragraph'))); /* Final output */ anewt_include('page'); $page = new AnewtPage(); $page->title = 'Anewt XHTML output test'; $page->append($fragment); $page->flush();