1. Go to this page and download the library: Download popphp/pop-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/ */
popphp / pop-view example snippets
<html>
<body>
<h1><?=$title;
use Pop\View\View;
use Pop\View\Template\File;
$view = new View(new File('hello.phtml'));
$view->title = 'Hello World!';
echo $view;
<!DOCTYPE html>
<html>
<head>
<title><?=$title;
use Pop\View\View;
use Pop\View\Template\File;
$view = new View(new File('hello.phtml'));
$view->title = 'Hello World!';
$view->content = 'This is a test!';
echo $view;
use Pop\View\View;
use Pop\View\Template\Stream;
$view = new View(new Stream('hello.html'));
$view->title = 'Hello World!';
$view->content = 'This is a test!';
echo $view;
use Pop\View\View;
use Pop\View\Template\Stream;
$view = new View(new Stream('index.html'));
$view->title = 'Hello World!';
$view->content = 'This is a test!';
echo $view;
use Pop\View\View;
use Pop\View\Template\Stream;
$view = new View(new Stream('child.html'));
$view->title = 'Hello World!';
$view->content = 'This is a test!';
echo $view;
use Pop\View\View;
use Pop\View\Template\Stream;
$data = [
'items' => [
'hello' => 'world',
'foo' => 'bar',
'baz' => 123
]
];
$view = new View(new Stream('index.html'), $data);
echo $view;
use Pop\View\View;
use Pop\View\Template\Stream;
$data = ['foo' => 'bar'];
$view = new View(new Stream('index.html'), $data);
echo $view;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.