Posts by Tag "DTL"

Subscribe to posts of this tag

Encouraging forks for Calypso DTL

I still get a bunch of emails regarding the Calypso DTL template engine that I have written some month ago and which i can currently not maintain any further (see my posting on that). Still I encourage anyone to fork the project and develop it further. Personally what I think is missing are some bugfixes and enhancements regarding the compiling and parsing. I created a GITHub Project for Calypso DTL, so collaborative development is very easy and added general TODOS to the README.txt that is on the front page of github project page.

Performance in Calypso (and Bugs)

I have tested Calypso performance some weeks ago and have not been able to write on it before. Don't use it please its fucking slow and cannot be optimized in the current architecture, because the template will NOT be parsed into intermediate PHP code.

Additionally there are some bugs:

  1. You cannot currently use UTF8 encoding since htmlentities deep in the escape mechanism cannot be given the utf-8 specification.
  2. Triple or higher inheritence may not work under some circumstances. Which sucks.

I sadly have no time currently to fix any of the issues poping up with Calypso, so please don't use it for anything production.

New Calypso DTL Version 0.2

I have got some hints about bugs and optimized the performance of loops a little bit, so that you can now download version 0.2 of the Calypso DTL template engine. Have fun.

Complete Django Template Engine Implementation for PHP5 - Downloadable Now

I prepared a downloadable version of my Django Template Language Engine Clone for PHP5 and the Zend Framework (although it can easily be used Standalone). It also implements two helpers that aid in rapid ajax/Dojox deployment. You can easily specify template blocks that should be rendered by Javascript via DojoX DTL, which are then marked, compiled and shown by the client using JSON data from the server. I included a demo to show this feature.

You can grab the Tarball and there is also a README with some information. I would appreciate if anbody would test the lib and gave some feedback.

I will soon start to push this component in the ZF proposal process. I still have to finish the class structure before I can move to the Ready for Review stage. The library will max end up in Zend Extras. Therefore I will have to say again: This View Renderer shall be no replacement for the current Zend View. It is only an alternative which allows for some neat functionality and stricter View / Controller logic seperation.

UPDATE: I finished a little page for what I call the Calypso DTL. See it here: Calypso Site. I have put up a little tutorial how to get the Template Engine running with Zend Framework and as a standalone component.

DojoX Django Template Language Example with Data from PHP/JSON

This is a simple example how you would use DojoX Django Template Language component filled with data from a JSON GET Response:

<script type="text/javascript" src="/development/dojo-release-1.1.1/dojo/dojo.js" djConfig="parseOnLoad:true, isDebug:true"></script>
 
<script language="javascript" type="text/javascript"><!--
dojo.require("dojox.dtl");
dojo.require("dojox.dtl.Context");
dojo.require("dojox.dtl.ext-dojo.NodeList");
dojo.addOnLoad(
    dojo.xhrGet({url: "dojotest.php", handleAs: "json", handle: function(data,ioArgs){
        if(typeof data == "error"){
            console.log("error?",data);
        } else {
            dojo.query("#test").dtl("I am eating {{food.fruit}} and {{food.meat}}", data);
        }
    }
}));
--></script>
<?php
header('Content-type: text/json');
$food = array('food' => array('fruit' => 'apple', 'meat' => 'chicken'));
echo json_encode($food);
?>