PHP Classes

File: test/06-variables/test.js

Recommend this page to a friend!
  Classes of Nikos M.   Contemplate   test/06-variables/test.js   Download  
File: test/06-variables/test.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Contemplate
Template engine that provides programming controls
Author: By
Last change:
Date: 1 year ago
Size: 754 bytes
 

Contents

Class file image Download
"use strict"; const echo = console.log; const Contemplate = require(__dirname+ '/../../src/js/Contemplate.js'); const tpl = '<% $v->prop %><% $v->func() %>'; Contemplate.add({ //'inline' : [tpl], 'test' : __dirname+'/test.tpl.html' }); // make sure it exists Contemplate.setCacheDir(__dirname); // dynamically update the cached template if original template has changed Contemplate.setCacheMode(Contemplate.CACHE_TO_DISK_AUTOUPDATE); function test() { this.prop = 'prop'; this.prop2 = this; this.func = function() {return 'func';}; this.getPropGetter = function() {return 'propGetter';}; this.method = function() {return this;}; } let arr = ['foo',{'prop':'prop'}]; echo(Contemplate.tpl('test', {'v':new test(),'a':arr}));