templating

Your attitude to Haml?

I'm considering Haml as a templating engine to use with PHP (via phammable). Do you know any potential drawbacks to using it? Googling seems to glorify it too much, all that markup haiku thing. ...

Python templates for web designers

What are some good templating engines for web designers? I definitely have my preferences as to what I'd prefer to work with as a programmer. But web designers seem to have a different way of thinking about things and thus may prefer a different system. So: Web designers: what templating engine do you prefer to work with? programme...

Creating PDF Invoices - Are there any templating solutions?

Our company is looking to integrate invoices into a new system we are developing. We require some a solution to create a layout of the invoice and then convert to pdf. We have considered just laying out the invoice in html/css then converting to pdf. We have also considered using SVG->PDf conversion. Both of these solutions integrate...

Silverlight Control Template Color Property

I am creating a Control Template for the Button control in Silverlight 2. I started with an empty template and added the visual elements I wanted. The main visual element is just a path (shape) filled with a color. The button control already has a Color property associated with it and I was wondering if it was possible to link the Col...

Using ASP.NET usercontrols for templating without having a Website project?

Is there a way of using ASP.NET user-controls (.ascx files) to fill my own templating needs within a .NET application, without that application being a Website? It's actually a class library that will take data in, combine it with a template, then spit it out. I don't want to write my own templating system from scratch, so I'm looking ...

Showing and hiding a DIV partially

Hi, I need to hide a DIV partially, not totally. When page loads, I want it to show the first, let's say, 100 pixels sitting on the uppermost part of the div. When the user clicks a certain button, the div will open (it could be a sliding effect like jQuery's show()). When the user clicks back the same button, the div will return to its ...

Is there any way to return HTML in a PHP function? (without building the return value as a string)

I have a PHP function that I'm using to output a standard block of HTML. It currently looks like this: <?php function TestBlockHTML ($replStr) { ?> <html> <body><h1> <?php echo ($replStr) ?> </h1> </html> <?php } ?> I want to return (rather than echo) the HTML inside the function. Is there any way to do this without build...

How can I create a tag in Jinja that contains values from later in the template?

I'm using Jinja2, and I'm trying to create a couple tags that work together, such that if I have a template that looks something like this: {{ my_summary() }} ... arbitrary HTML ... {{ my_values('Tom', 'Dick', 'Harry') }} ... arbitrary HTML ... {{ my_values('Fred', 'Barney') }} I'd end up with the following: This page includes inform...

John Resigs micro templating engine, question of how to handle selects?

I've a template that looks like so: <script type="text/html" id="TemplateEdit"> <td> <input type="hidden" value="<#= item.ID #>" id="Edit.ID" name="Edit.ID" /> <select id="Edit_ClientID" name="Edit.ClientID"> <option value="1">test</option> <option value="2">test 2</option> <optio...

Creating RSS/Atom feeds: template language or XML library?

I'm creating an RSS (and/or Atom) feed for my website. Now, I can immediately think of two ways to do this: Use the same templating system I use to generate the HTML (Clearsilver if anyone's wondering), basically just treating the RSS feed like any other web page that happens to be in RSS+XML instead of XHTML Use an XML library, or an ...

CL-WHO-like HTML templating for other languages?

Common Lisp guys have their CL-WHO, which makes HTML templating integrated with the "main" language thus making the task easier. For those who don't know CL-WHO, it looks like this (example from CL-WHO's webpage): (with-html-output (*http-stream*) (:table :border 0 :cellpadding 4 (loop for i below 25 by 5 do (htm (:tr :a...

What's a good way of doing string templating in .NET?

I need to send email notifications to users and I need to allow the admin to provide a template for the message body (and possibly headers, too). I'd like something like string.Format that allows me to give named replacement strings, so the template can look like this: Dear {User}, Your job finished at {FinishTime} and your file is av...

Interpolation and templating

I am trying to verify my understanding string interpolation and string templating. Is it correct to say that the two Java code snippets are examples of templating? public class Person { //showing only relevant code public String toString() { return "Name: " + name + " salary: " + salary + " address: " + address; } } public S...

Does anyone use ASP.net (webforms) to dynamically generate javascript and/or css files?

I prefer the use of external css and javascript files. There are however many cases where the content of a javascript or css file needs to be dynamic. I'll usually just transfer the javascript or css to inline or inpage code in my aspx page and handle the dynamic stuff there. Does anyone have a better approach? Would there be a way ...

Best PHP 5 Templating Techniques?

I am looking to build my own templating layer in php as part of my OOP Framework, but Im looking so some example of how to do this properly. I'd like to avoid parsing each html file to find comments that tell the templating engine what to do but rather use a faster/cleaner/modern technique. I just need some examples, because i've looked ...

Database calls in Smarty/views/templates

Today at work someone tried to convince me that: {$obj->getTableInfo()} is fine for smarty/mvc/templating because it is using an objects method. I argued that because it makes a call to the database it has no place being there and it should be in the controller (we don't actually use MVC). Am I right in my understanding of the logical...

Cheap php templating with vprintf?

Ok, so printf/sprint/vprintf all accept a certain type specifier syntax %[num][type]. (http://us2.php.net/sprintf see examples 3 and 4) Where num is the index to the type. Example: vprintf('Number %1$d string %2$s. String %2$s, number %1$d',array(1,"no")); Yes, it is limited... And you would need to maintain the indexes. But it's nativ...

Smarty templates uploaded during high trafficked site causes blank page

I work on a very high trafficked website that uses a Smarty templating system. When I upload a fresh copy of a template that is currently being used, the page turns blank (as if there is nothing in the template file itself). I have to shut down lighttpd, upload the template again, and start lighttpd back up. Are there any settings in S...

Which templating languages output HTML *as a tree of nodes*?

HTML is a tree of nodes, before all. It's not just a text. However, most templating engines handle their input and output as it was just a text; they don't care what happens around their tags, their {$foo}'s and <% bar() %>'s; also they don't care about what are they outputting. Sometimes they happen to produce a correct html, but that'...

what templating engine options are there for PHP?

I wonder what options there are for templating in PHP? If the templating code can be very similar to PHP, it'd be best. ...