template-engine

how to use Smarty better with PHP?

I found that using Smarty with PHP, sometimes extra time will need to be used for 1) using quite different syntax than PHP itself 2) need to check small cases, because documentation doesn't give finer details, such as for "escape" http://www.smarty.net/manual/en/language.modifier.escape.php it doesn't say escape:"quotes" is for double...

Generating HTML using a template from a .NET application

I have a .NET console application that needs to generate some HTML files. I could just construct the HTML in a StringBuilder and write the contents out to a file, but I was thinking it would be nicer to use some kind of template file with placeholders for where the data goes and then process my data through it at runtime. I'm guessing t...

Rendering C# Objects to Html

We have bunch of Domain Entities which should be rendered to an html format, which shows their detail in a pop up window. I would be glad to do something like this: Product product = new Product(...); product.ToHtml(); // or: HtmlRenderer.Render(Product); but my main problem is how to do this stuff from behind. I have 3 different an...

template engine implementation

I am currently building this small template engine. It takes a string containing the template in parameter, and a dictionary of "tags,values" to fill in the template. In the engine, I have no idea of the tags that will be in the template and the ones that won't. I am currently iterating (foreach) on the dictionnary, parsing my string t...

How do I execute ruby template files (ERB) without a web server from command line?

Hello! I need ERB (Ruby's templating system) for templating of non-HTML files. (Instead, I want to use it for source files such as .java, .cs, ...) How do I "execute" Ruby templates from command line? ...

Which template technology should I use with CherryPy?

I'm in the process of building a web application using cherrypy. What template technology do you recommend I use? ...

Formatting with mako

Anyone know how to format the length of a string with Mako? The equivalent of print "%20s%10s" % ("string 1", "string 2")? ...

When to use a Templating Engine in Python?

As a "newbie" to Python, and mainly having a background of writing scripts for automating system administration related tasks, I don't have a lot of sense for where to use certain tools. But I am very interested in developing instincts on where to use specific tools/techniques. I've seen a lot mentioned about templating engines, includ...

Velocity using #parse where the file doesn't exist

Hi, we use Velocity to template our configuration files for several different environments and this process works really well but I have a quick question relating parsing a file that doesn't exist. My question is: How do you check if a file exists before parsing it? So in the example the file default.user.properties might legitimately ...

Which templating engine is this?

At my current place of work we have to use a web-service which works with a text template we feed to it. Now we would like to use those templates at other places in code and so I wondered what template language that could possibly be and if it's some off-the-shelf or off-the-net software. It's presumably something from Java or .NET world...

Template system to create pdf in php

I am looking for an open source template engine in the style of smarty or dwoo (preferable dwoo due to its inheritance features) that can be used to create pdf files instead of html. I am not talking about just a pdf library that allows the creation of the function/method calls, but something that allows to create the page content in a s...

Using Cheetah Templating system with windows and python 2.6.1 (namemapper problem)

So I am trying to use the Cheetah templating engine in conjunction with the Django web framework, and that is actually working fine. I did some simple tests with that and I was able to render pages and whatnot. However, problems arise whenever doing anything other than using very simple variable/attribute/methods in the Cheetah templat...

Get argument value from TextTransform.exe into the template

Hello, I can't found some example how can I use argument -a when I use TextTransform.exe to generate code from templates. In MSDN is following description for argument -a: "Specifies a parameter that a directive processor can query for as a name/value pair. The directive processor and identifier are optional. This allows par...

jQuery: Templating data

I have a unique situation where I'm building a site that will call data via AJAX and load it into "containers" (basically just divs styled and arranged according to elements retrieved from the AJAX callback). I'm not sure how many of these unique container types will be created (styled and rendered) when all is said and done, so I'm lo...

What is the fastest template system for Python?

Jinja2 and Mako are both apparently pretty fast. How do these compare to (the less featured but probably good enough for what I'm doing) string.Template ? ...

Should I use Mako for Templating?

I've been considering a templating solution, although my choices are between Mako and Genshi. I find templating in Genshi a bit ugly, so I'm shifting more towards Mako. I've gone to wonder: what is so good about the fact that Mako allows embedded Python code? How is it convenient for the average joe? Wouldn't templating JUST suffice wi...

apache velocity: ship with compiled templates

Can I ship my application with compiled templates? I there such a thing at all compiled templates in velocity? Or are they obligatorily recompiled on every run? ...

Universal template/config syntax

I have a number of applications written in different languages (Java, JavaScript, PHP, etc.). Their view/presentation layers display things in various formats: HTML, plain text, etc. I want to display some textual/numeric data in roughly the same way in each application. Of course, the result would be slightly different depending on the...

Configure Velocity to fail on undefined $variable

Can Velocity be configure to fail (i.e. throw an Exception) when a $var is undefined. Such a "fail-fast" strategy would help in our testing cycles. ...

Velocity vs. FreeMarker

Velocity or FreeMarker? They look pretty much the same, even the syntax? What to use? Or when to use what? ...