\tbackground-color: #C2AE8E; } .dark-cell { \tbackground-color: #8C4B22; } div table.hot-pink { \tbackground-color: #F433ff; } PAGE_STYLES; $displayExamples = new Silkworm(); $displayExamples->doctype("html"); $displayExamples["head"] = $displayExamples->head($displayExamples->meta("charset", "UTF-8"), $displayExamples->title("Silkworm (tables example)"), $displayExamples->newline(), $displayExamples->meta("name", "description", "content", "This demostrates how to use tables."), $displayExamples->meta("name", "viewport", "content", "width=device-width"), $displayExamples->newline(), $displayExamples->comment("page styles"), $displayExamples->style($style)); $displayExamples["body"] = $displayExamples->body($displayExamples->newline(), $displayExamples->comment("example 1"), $displayExamples->div($displayExamples->p("Example 1 (basic)"), (string) $example1), $displayExamples->newline(), $displayExamples->comment("example 2"), $displayExamples->div($displayExamples->p("Example 2 (autoTable no attributes)"), (string) $example2), $displayExamples->newline(), $displayExamples->comment("example 3"), $displayExamples->div($displayExamples->p("Example 3 (autoTable with attributes)"), (string) $example3), $displayExamples->newline(), $displayExamples->comment("example 4"), $displayExamples->div($displayExamples->p("Example 4 (nested tables)"), (string) $example4), $displayExamples->newline(), $displayExamples->comment("example 5"), $displayExamples->div($displayExamples->p("Example 5 (alternating attributes)"), (string) $example5), $displayExamples->newline(), $displayExamples->comment("example 6"), $displayExamples->div($displayExamples->p("Example 6 (cell attributes)"), $displayExamples->autoTable($tableCellAttributes)), $displayExamples->newline(), $displayExamples->comment("example 7???"), $displayExamples->div($displayExamples->p("Example 7 (???)"), $displayExamples->repeat($displayExamples->autoTable($forReal, "class", "hot-pink"), rand(1, 40)))); $displayExamples["page"] = $displayExamples->html((string) $displayExamples["head"], (string) $displayExamples["body"]); //let's see how it looks print $displayExamples->stringWithDocumentHeader((string) $displayExamples["page"]); //////////////////////////////////////////////////////////////////////////////// // The MIT License (MIT) // // Copyright (c) 2013 Dodzi Dzakuma (http://www.nexocentric.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: //
/** * @test * @depends completeDocumentFromFragments */ public function repeatFragment() { $div = new Silkworm(); $div->div($div->div($div->p())); $html = new Silkworm(); $html->html($html->repeat($div, 2)); $this->assertSame("<html>\n" . "\t<div>\n" . "\t\t<div>\n" . "\t\t\t<p></p>\n" . "\t\t</div>\n" . "\t</div>\n" . "\t<div>\n" . "\t\t<div>\n" . "\t\t\t<p></p>\n" . "\t\t</div>\n" . "\t</div>\n" . "</html>\n", (string) $html); }