PHP code example of splashsky / modello

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

    

splashsky / modello example snippets


// odello = new Modello('path/to/views', 'path/to/cache');

/**
 * File Directory
 * | cache/views/
 *   example.php (will be created at render)
 * | views/
 *   example.mllo.php
*/

echo $modello->view('example', ['foo' => 'bar']);

echo Modello::parse('Hello, {{ name }}!', ['name' => 'Jerry']);

// This is the echo syntax
{{ $foo }}
{{ bar() }}

// This is the if-else syntax
@if(condition)
    // ...
@elseif(condition)
    // ...
@else
    // ...
@endif

// This is the foreach syntax
@foreach($array as $key => $value)
    {{ $key }} equals {{ $value }}
@endforeach

// This is a comment
{{-- I won't show up in the HTML or in the compiled template file! --}}

// This is the almighty