Skip to content

Functions for rendring a simple HTML template to pure HTML in JavaScript and PHP

License

Notifications You must be signed in to change notification settings

tojaskivi/xRender

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xRender

Functions for rendering a simple HTML template to pure HTML in JavaScript and PHP

Mimics Django's render function for JavaScript and PHP. Convenient to use if you have to create the same HTML structure in JavaScript and PHP. It allows you to write all the HTML in one place and then just pop in some values from hashmaps.

Template format:

<div class="user-wrapper">
    <div class="user">
        <a href="mailto:{{ email }}"><h2>{{ firstName }} {{ lastName }}</h2></a>
        <p>{{ about }}</p>
    </div>
</div>

Render to HTML with JavaScript

render(templateTextBlob, {
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe",
    "about": "This function would properly render the template above."
})

Render to HTML with PHP

<?php
render("path/to/template.html", [
    "email" => "[email protected]",
    "firstName" => "John",
    "lastName" => "Doe",
    "about" => "This function would properly render the template above."
]);

About

Functions for rendring a simple HTML template to pure HTML in JavaScript and PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 48.5%
  • JavaScript 24.1%
  • CSS 18.6%
  • Hack 4.8%
  • HTML 4.0%