templates

What's a good templating system for PHP?

What's the best/easiest to integrate templating system for PHP, and what are the benefits of using one? I currently don't use one at all, and am thinking that it might help to seperate content from presentation a little more. ...

How do I configure email notification on new case comment in salesforce.com?

In salesforce.com, I have a workflow that triggers when a new case comment is added via the self-service portal. The workflow rule updates the Case.Status field, which fires another workflow rule on the Case object itself. The end result is an email to the case owner that is notified that a new case comment has been added. However, I ...

How to build the DOM using javascript and templates?

I am building an application where most of the HTML is built using javascript. The DOM structure is built using some JSON data structures that are sent from the server, and then the client-side code builds a UI for that data. My current approach is to walk the JSON data structures, and call script.aculo.us's Builder.node method to bu...

How do you mark a struct template as friend ?

I have code like this: template <typename T, typename U> struct MyStruct { T aType; U anotherType; }; class IWantToBeFriendsWithMyStruct { friend struct MyStruct; //what is the correct syntax here ? }; What is the correct syntax to give friendship to the template ? ...

Templated superclass linking problem

I'm trying to create a C++ class, with a templated superclass. The idea being, I can easily create lots of similar subclasses from a number of superclasses which have similar characteristics. I have distilled the problematic code as follows: template_test.h: template<class BaseClass> class Templated : public BaseClass { public: ...

How to easily map c++ enums to strings

I have a bunch of enum types in some library header files that I'm using, and I want to have a way of converting enum values to user strings - and vice-versa. RTTI won't do it for me, because the 'user strings' need to be a bit more readable than the enumerations. A brute force solution would be a bunch of functions like this, but I f...

Code / template generator for Java

For C#, I have often used CodeSmith and lately the T4 generator which is part of Visual Studio. I'm looking for something similar for Java, in particular an Eclipse add-in since I do all my Java development using the Eclipse IDE. ...

C++: Use 'class' or 'typename' for template parameters?

When defining a function template or class template in C++, one can write this: template <class T> ... or one can write this: template <typename T> ... Is there a good reason to prefer one over the other? I accepted the most popular (and interesting) answer, but the real answer seems to be "No, there is no good reason to prefer ...

Parsing of nested tags in a file

Hi, I am wondering - What's the most effective way of parsing something like: {{HEADER}} Hello my name is {{NAME}} {{#CONTENT}} This is the content ... {{#PERSONS}} <p>My name is {{NAME}}.</p> {{/PERSONS}} {{/CONTENT}} {{FOOTER}} Of course this is intended to be somewhat of a templating system in the end, s...

What are some uses of template template parameters in C++?

I've seen some examples of C++ using template template parameters (that is templates which take templates as parameters) to do policy-based class design. What other uses does this technique have? ...

Software / System Handover Template - Are there any good examples out there?

I'm required to provide a handover to our content editors for the update corporate website I've just released. Apparently a training session with notes isn't sufficient. Fair enough. So more dreaded documentation looms. After a fairly brief trawl over Google, I'm unable to find any relevant and usable template to use as the basis of ...

c++ template function overloading.

Below are lines from "the c++ programming language" template<class T > T sqrt(T ); template<class T > complex<T> sqrt(complex<T>); double sqrt(double); void f(complex<double> z ) { s q r t (2 ); // sqrt<int>(int) sqrt(2.0) ; // sqrt(double) sqrt(z) ; // sqrt<double>(complex<double>) } I dont understand why sqrt(z) ; calls sqrt<double>...

Using aspx Rendering Engine to Generate Non-HTML

Is it possible to use the asp templating engine (With the partial code-behind class, dynamic <% ... %> blocks and such) to generate non HTML? I want to have a clean and maintainable way to generate code dynamically. (Specifically, I want to generate LaTeX code populated with values from a database.) Currently my LaTeX templates are res...

A form that spits out the input

I can't for the life of me find a form that DOESNT email the results that you submit. I'm looking to find a form that I can have users enter simple data that i can then spit back out at them in different arrangements. If they submit First and Last, I'll spit out, amongst other things, [email protected]. I'm willing to scrounge the co...

C++ template instantiation of function template parameters

Hi, I have the following problem using template instantiation [*]. file foo.h class Foo { public: template <typename F> void func(F f) private: int member_; }; file foo.cc template <typename F> Foo::func(F f) { f(member_); } file caller.cc Foo::func(boost::bind(&Bar::bar_func, bar_instance, _1)); While this c...

Getting template text from FreeMarker in Spring app

Hi, In my Spring app, I'd like to use FreeMarker to generate the text of emails that will be sent by my application. The generated text will never be returned to the view so I don't need to configure a FreeMarker view resolver. The documentation seems to indicate that I should configure a FreeMarkerConfigurationFactoryBean like this <b...

Can initialization list in constructors be used in template classes?

I find that most books concerning C++ templates don't tell anything about whether it's possible or not to use initialization list in constructor of a template class. For example, I have code like this: template <class T> class Stack { T* data; std::size_t count; std::size_t capacity; enum {INIT = 5}; public: Stack()...

C++ two or more data types in declaration

...

Does StringTemplate work with Struts?

I would like to use a template engine in my struts web application. Therefore I would like to use StringTemplate, but have no idea how to implement in Struts. ...

cache FreeMarker templates

Hi, I'm using the Spring class FreeMarkerConfigurationFactoryBean to retrieve FreeMarker templates. I would like these templates to be cached, but there doesn't appear to be any way to indicate that this behaviour is required. In contrast, Spring modules provides a CachingTemplateResolver which does provide template caching, but is it ...