2017 © Pedro Peláez
 

library render

A very simple view rendered for PHP based templates.

image

tjlytle/render

A very simple view rendered for PHP based templates.

  • Sunday, February 23, 2014
  • by tjlytle
  • Repository
  • 1 Watchers
  • 5 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Render

A very simple rendered for PHP based templates. Not a template language, just a simple wrapper that handles undefined template variables, helper functions, and turing a phtml file into a string., (*2)

If you're using some kind of framework, you probably shouldn't be using this. I threw this together to be pasted (yes, pasted, if you have composer up and running, pull in a real template library) into exsisting legacy projects and turn classic HTML with embedded PHP into a bit more up-to-date PHP rendered templates., (*3)

Features

  • Set View Variables
  • Set View Helpers
  • Render Template in Layout

Example

index.php:, (*4)

$render = new Render('layout.phtml');
$render->name = 'Tim';
$render->message = 'This is a secret message';
$render->encode = function($value){
    return str_rot13($value);
};

echo $render('template.phtml');

layout.phtml:, (*5)

<html>
  <head>Example Layout</head>
  <body>
    <h1>My Old Site</h1>
    <div><?php echo $this->content; ?></div>
  </body>
</html>

template.phtml, (*6)

<p>Hi <?php echo $this->name ?>, welcome back.</p>
<p>Here's your secret message: <?php echo $this->encode($this->message); ?></p>

The Versions

23/02 2014

dev-master

9999999-dev

A very simple view rendered for PHP based templates.

  Sources   Download

MIT

The Development Requires

templating template renderer view

22/02 2014

v1.0.0

1.0.0.0

A very simple view rendered for PHP based templates.

  Sources   Download

MIT

The Development Requires

templating template renderer view