// and One that supports nesting: $H $H = new KvzHTML(); $E = new KvzHTML(array('echo' => true, 'buffer' => true, 'tidy' => true)); // To save you even more typing. The following tags // have an inconsistent interface: // a, img, css, js $E->html(); $E->head($H->title('Report') . $H->style(' div.page { font-family: helvetica; font-size: 12px; page-break-after: always; min-height: 1220px; width: 830px; } ') . $H->css('/css/style.js') . $H->js('/js/jquery.js')); // Page 1 $E->page(true, array('style' => array('page-break-before' => 'always'))); $E->h1('Report') . $E->p($H->a('http://true.nl', 'Visit our homepage') . $H->img('http://true.truestatic.nl/pivotx/templates/true/img/logo.gif')); $E->ul($H->li('Health') . $H->li('Uptime') . $H->li('Logs') . $H->li('Recommendations')); $E->page(false); // Page 2 $E->page(); $E->float($H->img('http://en.gravatar.com/userimage/3781109/874501515fabcf6069d64c626cf8e4f6.png')); $E->float($H->img('http://en.gravatar.com/userimage/3781109/874501515fabcf6069d64c626cf8e4f6.png')); $E->clear(); $E->page(false); // Page 3 $E->page($H->h2('Warnings') . $H->p('Disk space', array('class' => 'warning'))); $E->html(false); echo $E->getBuffer();
// - echo output, don't return // - save all echoed output in a buffer // - Don't automatically Tidy the output (btw, only works with buffer on) $E = new KvzHTML(array('track_toc' => true, 'link_toc' => false, 'echo' => true, 'buffer' => true, 'tidy' => false)); $E->h1('New application'); $E->p($E->loremIpsum); $E->h2('Users'); $E->blockquote($E->loremIpsum); $E->h3('Permissions'); $E->p($E->loremIpsum); $E->h4('General Concept'); $E->p($E->loremIpsum); $E->h4('Exceptions'); $E->p($E->loremIpsum); $E->h3('Usability'); $E->ul(); // An empty body will just open the tag: <ul> $E->li('Point 1'); $E->li('Point 2'); $E->li(); $E->strong('Point 3'); $E->br(null); // NULL will make a self closing tag: <br /> $E->span('Has some implications.'); $E->li(false); $E->ul(false); // False will close the tag: </ul> // Save both chucks so further KvzHTML calls // wont impact them anymore $toc = $E->getToc(); $document = $E->getBuffer();