PHP code example of kmklabs / xbt

1. Go to this page and download the library: Download kmklabs/xbt 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/ */

    

kmklabs / xbt example snippets


$contents    = file_get_contents("template.xbt.php");
$tokenizer   = new Tokenizer($contents);
$tokenStream = $tokenizer->tokenize();
$parser      = new Parser($tokenStream);
$result      = $parser->parse();



class __xbt_4bc492834a61e30d17d158c6a052837584b1db90 extends App\Publishing\Lib\Xbt\Runtime
{
    public function render()
    {
        return <x:frag>
    <h1>This is a header</h1>
    {$this->block_main()}
    <p>This is a simple footer</p>
</x:frag>;
    }

    public function block_main()
    {
        return <x:frag>
    <p>This is inside a block</p>
     {$this->block_submain()}
</x:frag>;
    }

    public function block_submain()
    {
        return <x:frag>
    <p>This is a block inside a block</p>
</x:frag>;
    }
}