template-engine

Template Engines for Spring Framework

I've taken quite a shine to the Spring Framework and would like to get into it a bit more. I have noticed that aside from plain vanilla JSPs there are various template engines for use with Spring MVC, such as Velocity and Freemarker. Are there others? Which one do you recommend? ...

What is the best code template facility for Emacs?

Particularly, what is the best snippets package out there? Features: easy to define new snippets (plain text, custom input with defaults) simple navigation between predefined positions in the snippet multiple insertion of the same custom input accepts currently selected text as a custom input cross-platform (Windows, Linux) dynamicall...

PHP as a template language, or some other PHP templating script?

Is PHP on it's own a good enough templating language, or should one use something like Smarty to write PHP templates in? ...

How do I use Django templates without the rest of Django?

I want to use the Django template engine in my (Python) code, but I'm not building a Django-based web site. How do I use it without having a settings.py file (and others) and having to set the DJANGO_SETTINGS_MODULE environment variable? If I run the following code: >>> import django.template >>> from django.template import Template, ...

What is your single favorite Python templating engine?

Name your single favorite Python templating engine (and describe why it's your favorite). ...

Template Lib (Engine) in Python running with Jython

Im searching a Template Lib or Template Engine for generating HTML (XML) that runs under Jython (Jython 2.5 Alpha is ok). ...

Suggestions for a Java-based templating engine?

Do you know a better template engine than FreeMaker or Velocity? ...

Custom php template engine: Am i finally on the right track?

Hi everyone, Since I keep showing up late for answering questions tagged php where i actually know the answer i figured i'd try asking a question myself. I've been working on so many complete rewrites of a custom template engine in php for so long and so many times that i thought i'd ask for opinions. In short, this is the most import...

Safe PHP Template Engines

What are some PHP template engines that offer a simple, short syntax? What we're looking for is: Conditionals (if/else) Foreach loops Variable replacements Able to create custom tags (i.e., for URL generators) We need it to be secure because the applications are being run on our own servers, but we still want people to be able to edi...

Velocity #parse but assign it to a variable

Say you have a standard template with included (parsed) header, body, footer templates. In the body template a variable like $subject is defined and you want that also displayed in the header template. In some other template languages like HTML::Mason(perl based) you would evaluate the body template first to pick up the $subject variab...

What is the best way to insert HTML via PHP ?

Hey, Talking from a 'best practice' point of view, what do you think is the best way to insert HTML using PHP. For the moment I use one of the following methods (mostly the latter), but I'm curious to know which you think is best. <?php if($a){ ?> [SOME MARKUP] <?php } else{ ?> [SOME OTHER MARKUP] <?php } ?> Opposed to: <?ph...

Any lightweight templating solutions in Java with support for conditional formatting?

I'm using MessageFormat to format some addresses with a template like this: "{0}\n{1}\n{2}\n{3}, {4} {5}" where 0 = street 1 1 = street 2 2 = street 3 3 = city 4 = state 5 = zip Most of these fields are optional when captured. How do I avoid having an empty line when for instance, there is not street 3? I could use a template lik...

T4 Templates - suitable for generating C++ code?

Are there any issues which might make MS's T4 Template code-generation system unsuitable for generating C++ code? ...

if-else in FreeMarker template

Hi, FreeMarker templates support an if-statement with the following syntax <#if hot> It's hot. </#if> I've looked in the documentation and can't find any support for an if-else statement. Of course I could achieve the same result with: <#if hot> It's hot. </#if> <#if !hot> It's not hot. </#if> Is support for if-else pro...

parsing html <script> via PHP isn't working completely.

I find this very strange, must be something I'm doing wrong, but still... I'm working on a page using PHP and TPL files. In my TPL file, there's a place in the footer for some extra lines if needed. For instance, formchecking with Javascript. so in PHP I did this: $foot = "<script type=\"text/javascript\">if(document.getElementById){l...

How do I check to see if a Smarty variable is already assigned?

How do I check to see if a particular value has already been assigned to Smarty and if not assign a (default) value? Answer: if ($this->cismarty->get_template_vars('test') === null) { $this->cismarty->assign('test', 'Default value'); } ...

C++ HTML template framework, templatizing library, HTML generator library

I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc. It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc. Parameter passing to template rendering engine is also important if I could pass all of them in a hash map inst...

Smarty benchmark, anyone?

Hey, I am considering Smarty as my web app templating solution, and I am now concerned with its performance against plain PHP. The Smarty site says it should be the same, however, I was not able to find anyone doing real benchmarking to prove the statement right or wrong. Did anyone do some benchmarking of Smarty vs plain PHP? Or may...

Looking for an easy templating solution with ruby

Hello, I am looking for a simple templating solution for ruby, i.e. something that will let me write php-like or jsp-like templates (html with embedded code tags), but in ruby. jsp is no good for me, because most hosting services (I'm on dreamhost) don't support it on their default package, and it's a little cumbersome to set up. php is...

Does anyone know of a Python equivalent of FMPP?

Does anyone know of a Python equivalent for FMPP the text file preprocessor? Follow up: I am reading the docs and looking at the examples for the suggestions given. Just to expand. My usage of FMPP is to read in a data file (csv) and use multiple templates depending on that data to create multi page reports in html all linked to a main ...