PHP code example of machy8 / macdom

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

    

machy8 / macdom example snippets


$macdom = new Macdom\Engine;
$compiled = $macdom->compile($content);


use Macdom\Bridges\Latte\FileLoader;
use Macdom\Engine;

/**
 * @var Engine
 */
private $macdom;

/**
 * @var FileLoader
 */
private $fileLoader;


public function __construct(Engine $macdom, FileLoader $fileLoader) {
	$this->macdom = $macdom;
	$this->fileLoader = $fileLoader;
}


protected function createTemplate()
{
	$template = parent::createTemplate();
	$this->fileLoader->setMacdom($this->macdom);
	$template->getLatte()->setLoader($this->fileLoader);
	return $template;
}