1. Go to this page and download the library: Download dijitaltrix/scythe-view 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/ */
@section('body')
<ul>
@foreach ($muppets as $muppet)
@
// output a string
$view->addDirective('/@hello/i', 'Hello world');
// output the result of a callback
$view->addDirective('/@hello/i', function(){
return 'Hello world';
});
//TODO pass parameters from directive to callback
$view->addDirective('@rand', function() {
if (rand(1,10) > 5) {
throw new Exception("This is pointless");
}
});
// add the namespace name first, followed by the path to the root of the namespace
$view->addNamespace("admin", "/src/Admin/views");
// namespaces are referenced with '::'
// for example
$view->exists('admin::user/dashboard');
// this will load the file at src/Admin/views/user/profile.blade.php
$view->render($response, 'admin::user/profile', $args);
$view->exists('admin/dashboard')
// Namespaces are specified as follows
$view->exists('admin::user/dashboard')