PHP Classes

Wepesi PHP View Class: Renders view output from template script files

Recommend this page to a friend!
  Info   View files Example   View files View files (16)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 25 All time: 11,124 This week: 560Up
Version License PHP version Categories
wepesi-view 1.0The PHP License5PHP 5, Templates, Design Patterns
Description 

Author

This package renders view output from template script files.

It provides a view class that can take the name of a PHP script file as a parameter and load that script from a given root directory to execute the file PHP code.

The class can also take the template parameter values before executing the template script and assign local variables to the parameter values.

The script can use the variables during its execution to configure aspects of the view.

Picture of Boss Ibrahim Mussa
  Performance   Level  
Name: Boss Ibrahim Mussa <contact>
Classes: 13 packages by
Country: Congo Congo
Age: ???
All time rank: 29031 in Congo Congo
Week rank: 31 Up1 in Congo Congo Equal
Innovation award
Innovation award
Nominee: 5x

Example

<?php
include "vendor/autoload.php";
use
Wepesi\Routing\Router;
use
Wepesi\View;


$router = new Router();

$router->get('/', function () {
   
$view = new View();
   
$view->display('home');
});
/**
 * with sub folder
 */
$router->get('/child', function () {
   
$view = new View();
   
$view->display('child/hello.html');
});
/**
 * with an other root folder
 */
$router->get('/other-root', function () {
   
$view = new View();
   
$view->setRoot('/demo');
   
$view->assign('users', [
        [
'name' => 'John Doe'],
        [
'name' => 'Jane Doe']
    ]);
   
$view->display('users.php');
});

$router->run();


Details

wepesi-view

Simple view engine, just to share data across pages


  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder image.idea (4 files)
Files folder imagedemo (2 files)
Files folder imagesrc (1 file)
Files folder imageviews (2 files, 1 directory)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files  /  .idea  
File Role Description
  Accessible without login Plain text file modules.xml Data Auxiliary data
  Accessible without login Plain text file php.xml Data Auxiliary data
  Accessible without login Plain text file vcs.xml Data Auxiliary data
  Accessible without login Plain text file wepesi-view.iml Data Auxiliary data

  Files folder image Files  /  demo  
File Role Description
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file users.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
  Plain text file View.php Class Class source

  Files folder image Files  /  views  
File Role Description
Files folder imagechild (1 file)
  Accessible without login Plain text file 404.php Aux. Auxiliary script
  Accessible without login Plain text file home.php Aux. Auxiliary script

  Files folder image Files  /  views  /  child  
File Role Description
  Accessible without login HTML file hello.html Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:25
This week:0
All time:11,124
This week:560Up