PHP code example of klan1 / k1.lib-html

1. Go to this page and download the library: Download klan1/k1.lib-html library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

klan1 / k1.lib-html example snippets


use k1lib\html\html_document;
use k1lib\html\body;
use k1lib\html\div;

$doc = new html_document();
$body = $doc->append_body();
$div = $body->append_div("main-container");
$div->set_value("Hello, k1lib.html!");

echo $doc->generate();

// Enable debug mode
\k1lib\html\tag::debug(true);

// Now all generate() calls will ="k1lib\html\div">Content</div>

// Disable debug mode
\k1lib\html\tag::debug(false);

// Check current debug state
$isDebug = \k1lib\html\tag::debug(); // returns bool