Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php declare(strict_types = 1);
- namespace test;
- use DOMDocument;
- use Templado\Engine\SimpleSnippet;
- use Templado\Engine\SnippetListCollection;
- use Templado\Engine\Templado;
- require __DIR__ . '/vendor/autoload.php';
- $codeBlock = new DOMDocument();
- $element = $codeBlock->createElement('h1', 'This Is A Simple Snippet Example');
- // If you enable the following line, the h1 element in the document will get replaced,
- // otherwise this h1 will become a child of the h1 of the document
- //$element->setAttribute('id', 'header');
- $snippet = new SimpleSnippet('header', $element);
- $html = Templado::parseHtmlString('<?xml version="1.0" ?><html><h1 id="header" /></html>');
- $collection = new SnippetListCollection();
- $collection->addSnippet($snippet);
- $html->applySnippets($collection);
- echo $html->asString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement