Coder Social home page Coder Social logo

boomyjee / php-liquid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harrydeluxe/php-liquid

2.0 2.0 0.0 532 KB

A PHP port of Ruby's Liquid Templates

Home Page: http://www.delacap.com/artikel/Liquid-Templates/

License: MIT License

PHP 100.00%

php-liquid's Introduction

Liquid template engine for PHP

Liquid is a PHP port of the Liquid template engine for Ruby, which was written by Tobias Lutke. Although there are many other templating engines for PHP, including Smarty (from which Liquid was partially inspired), Liquid had some advantages that made porting worthwhile:

  • Readable and human friendly syntax, that is usable in any type of document, not just html, without need for escaping.
  • Quick and easy to use and maintain.
  • 100% secure, no possibility of embedding PHP code.
  • Clean OO design, rather than the mix of OO and procedural found in other templating engines.
  • Seperate compiling and rendering stages for improved performance.
  • Easy to extend with your own tags and filters.
  • 100% Markup compatibility with a Ruby templating engine, making templates usable for either.
  • Unit tested: Liquid is fully unit-tested. The library is stable and ready to be used in large projects.

Why Liquid?

Why another templating library?

Liquid was written to meet three templating library requirements: good performance, easy to extend, and simply to use.

Basics

Example snippet:

{% if products %}
	<ul id="products">
	{% for product in products %}
	  <li>
		<h2>{{ product.name }}</h2>
		Only {{ product.price | price }}
	
		{{ product.description | prettyprint | paragraph }}
		
		{{ 'it rocks!' | paragraph }}
		
	  </li>      
	{% endfor %}
	</ul>
{% endif %}

Howto use Liquid

Code to render:

$liquid->parse(file_get_contents('templates/products.tpl'))->render($products);

Requirements

  • PHP 5.1+

Issues

Have a bug? Please create an issue here on GitHub!

https://github.com/harrydeluxe/php-liquid/issues

Fork Notes

This fork is based on php-liquid by Mateo Murphy. The original library is still hosted at: (http://code.google.com/p/php-liquid/)

php-liquid's People

Contributors

boomyjee avatar v1o avatar warezthebeef avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.