PHP Classes

Jade Spark: Process template files using Jade Node.js module

Recommend this page to a friend!
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 173 All time: 8,800 This week: 455Up
Version License PHP version Categories
jade-spark 0.0.2BSD License5.3.0PHP 5, Templates


This class can process template files using Jade Node.js module.

It can take a given template file in the Jade format and call the Jade module process the template.

The class can encode additional parameters in JSON format to be passed to Jade.

The processed template is displayed as the current script output.

Picture of Leo Daidone
  Performance   Level  
Name: Leo Daidone <contact>
Classes: 2 packages by
Country: Argentina Argentina
Age: 45
All time rank: 323742 in Argentina Argentina
Week rank: 271 Up4 in Argentina Argentina Up



This is a small class that let you use Jade-lang template engine.


You will need to have Jade binary installed in your system.

To install via npm:

### Usage:

Create a view template, with `.jade` extension. (check Examples section)
For Jade-lang references click here

In your PHP file create an instance of Jade_spark:

... require_once('jade_spark.php'); $jade = new Jade_spark(); ...

*Jade_spark constructor method support two arguments, the first is for templates root path, defaulted as current directory. 
The second is to set Jade binary full path, defaulted as `/usr/bin/jade`.*

Optionally you can prepare array of variables needed in templates.

Finally, invoke `render` method in your controller, passing template name as first argument and optional array of params as second argument.

... $jade->render("index",$params); ...

### Examples:



$jade = new Jade_spark();


Jade template

doctype html
      title "testing Jade Spark"
         = "This is my first jade view with PHPClasses!!!"
         = "For more Jade-lang references:"
         a(href='') Jade-lang API

HTML Result

<!DOCTYPE html>
        <title>"testing Jade Spark"</title>
        <div id="content">
            This is my first jade view with PHPClasses!!!
            For more Jade-lang references: <a href="">Jade-lang API</a>

  Files folder image Files  
File Role Description
Files folder imageexample (2 files)
Plain text file CLIStatus Class CLI Status
Plain text file Jade_spark Class Jade_spark
Plain text file jade_spark.php Class jade_spark.php
Accessible without login Plain text file Doc. README.markdown

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file example.php Example small example
  Accessible without login Plain text file index.jade Data example of jade template

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,800
This week:455Up