PHP code example of cobbdb / eta

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

    

cobbdb / eta example snippets


// index.php
d";
echo H::render(null, [
    "name" => $who
]);

// base.view
Hello <?= $name 

<div id="myWidget">
    <?= H::render("neat/widget.html") 

// The 'grounded' argument can bypass the home directory
$myView = H::render("../my/template.html", [], false);

// Default is the same directory in which eta.php file is placed.
H::setHome("/path/to/my/templates/");

// Default is ./base.view
H::setBase("/path/to/myBase.html");
// Now H::render(null) will use a new base template!

// Use special templates directory temporarily.
H::setHome("../path/to/other/templates/");
H::render("some/newThing.tpl");
H::render("and/another/template.html");
// Now reset home back to default for rest of project!
H::reset();