templating

Python: Need to replace a series of different substrings in HTML template with additional HTML or database results

Situation: I am writing a basic templating system in Python/mod_python that reads in a main HTML template and replaces instances of ":value:" throughout the document with additional HTML or db results and then returns it as a view to the user. I am not trying to replace all instances of 1 substring. Values can vary. There is a finite...

Templating Html.DisplayFor() in ASP.NET MVC 2

It appears that if you just use Html.DisplayFor(model => model) with no templates for a Details view, the resulting markup will look something like this: <div class="display-label">first name</div> <div class="display-field">Dan</div> <div class="display-label">last name</div> <div class="display-field">M</div> <div class="display-label...

What is a good templating solution for the creation of simple static websites ?

I want to streamline the process by which I create static websites. I want to avoid having to do multiple editing operations when I have to change one page element, like the text or image in a footer. I want to be able to use my tool on a local computer, in order to upload the resulting structure to my server. I don't want to use a to...

What's the best place to discuss push-style templating in a language-agnostic way?

I'm a perl developer and I've compiled a list of push-style templating systems: http://perlmonks.org/?node_id=674225 Where push-style is defined in terms of Terence Parr's seminal paper on the topic: http://perlmonks.org/?node_id=674225 What is the best place to discuss such systems? ...

Templating engine for .NET Compact Framework

Does anyone know any templating engine that works under .NET Compact Framework 3.5? ...

Django: using variables as array indices?

I am trying to create a template that will put items in a table. Controller: items = Item.all().order('name').fetch(10) template_values = {'items': items, 'headers': ['Name', 'Price', 'Quantity']} render('Views/table.html', self, template_values) Template: <table> <tr> {% for header in headers...

PHP templating challenge (optimizing front-end templates)

Hey all, I'm trying to do some templating optimizations and I'm wondering if it is possible to do something like this: function table_with_lowercase($data) { $out = '<table>'; for ($i=0; $i < 3; $i++) { $out .= '<tr><td>'; $out .= strtolower($data); $out .= '</td></tr>'; } $out .= "</table>"; ...

Text transforms on all of objects properties, is there a better way?

Currently I am doing this: I have text that looks like: Hello ${user.name}, this is .... And I do this: public string TransformUser(User user, string text) { StringBuilder sb = new StringBuilder(text); sb.Replace("${user.name}", user.Name); ... ... return sb.ToString(); } Is there a better way, maybe using reflection ...

Cross-domain templating with Javascript

I'm currently building a Javascript library that can be used to easily create embeddable media based on the URL of a media file, and then be controlled using Javascript methods and events (think something like the Flash / Silverlight JW player). Of course, i could simply cat all the html tags from the Javascript library and send that t...

Pass associative arrays in call_user_func_array(...)

Hey all, I'm building a templating system and I'm running in to an issue with calling functions on the fly. When I try the following: $args = array( 4, 'test' => 'hello', 'hi' ); You know.. some numerical elements some associative elements, call_user_func_array($function, $args); converts the array to something like ...

Looking For A Good HTML Templater for PHP

That's an HTML templater, not a php templater, not java or whatever. I am looking for something like HAML for PHP. I tried the 2 projects for PHP, PHAML and PHPHaml both of which are suffering from serious bugs. Do you know of any good html templater out there, preferably for PHP? EDIT I''m looking for something that can turn this <...

Make object available within php functions without passing them or making them global

Hey all, This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code: Librarian.php: $class = "slideshow"; $function = "basic"; $args = array(...); $librarian = $this; // I WOULD LIKE THIS...

how to use ob_start?

Hello I am using PHPSavant templating system for a project and I am not sure how to use ob_start in this. I have tried before .. for example, page_header.php -- ob_start(); page_footer.php -- ob_end_flush(); But because now I am using a templating system.. am not sure where to put these function. $template = new Savant3(); $templ...

Seeking reporting or templating tool to generate large formatted PDF reports from dataset

Say I have some data in MySQL or a big ole CSV file. I also have a report. It's a PDF, call it 100 pages long. I need to generate variations on this PDF for slices of the data. More specific example: I have a CSV file with each StackOverflow user in a row and each column contains various statistics about that user. I have a report ...

Ideas on C# DSL syntax

Hi, I am thinking about implementing a templating engine using only the plain C#/.NET 4 syntax with the benefit of static typing. Then on top of that templating language we could create Domain Specific Languages (let's say HTML4, XHTML, HTML5, RSS, Atom, Multipart Emails and so on). One of the best DSLs in .NET 4 (if not only one) i...

JQuery Pure Template

I cant figure out whats wrong. Its working when i tried to refresh only topics but it doesnt works when tried to refresh topics and page-links. ie. topics table's refreshing, and 'pagelinks' disappearing, i thought pure cannot reach - read second template node. By the way, i tested their code, first message box show up all of nodes - in...

Bash Templating: How to build configuration files from templates with Bash?

Hello. I'm writting a script to automate creating configuration files for Apache and PHP for my own webserver. I don't want to use any GUIs like CPanel or ISPConfig. I have some templates of Apache and PHP configuration files. Bash script needs to read templates, make variable substitution and output parsed templates into some folder. ...

Frontend Intertag Communication

Hey all, I've had a question that I've been wondering for a while. I'm making a templating system for front-ends where tags are interpretted (like Smarty). I was wondering if there is value in having the tags be able to communicate with the HTML document and other "Smartyish" tags. I was hoping that the community would have some thought...

Can a python view template be made to be 'safe/secure' if I make it user editable?

Say I need to have a templating system where a user can edit it online using an online editor. So they can put if tags, looping tags etc., but ONLY for specific objects that I want to inject into the template. Can this be made to be safe from security issues? i.e. them somehow outputing sql connection string information or scripting t...

Conditional Styling In Silverlight?

Hi, While I'm fine with standard control styling in silverlight I have recently began using more dynamic methods of fetching data to be displayed in items controls. One of the controls I am reworking is a collection of links. The issue I am having is that each link is coloured differently when moused over. One red, one blue, one green,...