templates

Simple template var replacement, but with a twist

So I'm setting up a system that has a lot of emails, and variable replacement within it, so I'm writing a class to manage some variable replacement for templates stored in the database. Here's a brief example: // template is stored in db, so that's how this would get loaded in $template = "Hello, %customer_name%, thank you for contact...

ASP.Net MVC 2,0 EditorForModel Question

Hi All I have written an Enum extension method that allows me to create a view model and allows me to easily bind a generic Enum to a SelctList like: this.ProductStatusList = new ProductStatusTypes().BindToSelectList<ProductStatusTypes> (product.Status.ToString()); In my View I can then have: <% using (Html.BeginForm()) {%> ...

serialize any data type as vector<uint8_t> - use reinterpret_cast?

I didnt find anything directly related in searching, so please forgive if this is a duplicate. What I am looking to do is serialize data across a network connection. My approach is to convert everything I need to transfer to a std::vector< uint8_t > and on the receiving side unpack the data into the appropriate variables. My approach lo...

Have a WPF Control Class being a template class

Hey, is there a way to have a WPF UserControl Class to be a class with a Template type? e.g. public partial class MyControl : UserControl should be: public partial class MyControl<MyData> : UserControl as I always get compile errors that MyControl than has no reference to InitializeComponents which is in the automatic generated pa...

Is it possible to create a mediawiki table where the columns are filled in by multiple templates?

Wikimedia explains how you can create a table based on multiple templates, where each row is formed from a single template. Is there anyway to do the same for columns? It sounds easy but I could not get it to work. Instead my page displayed multiple tables instead of multiple columns. Here's some code: Row page {|class="wikitable sort...

Generic way to return a whole collection

In C++, what is the best way to return a collection to client code without using iterators. Let's say iterators are ruled out because eg the collection is remote. I'd like a signature for a function that returns the collection in the most useful form possible. By 'best', I mean the best trade-off between clarity and genericity. My in...

how to extends the parent html page on google app engine

templates | ....a.html |.....admin |..... index.html |..... b.html in google app engine templates, i can use this to extends b.html in index.html: {% extends 'b.html' %} but how to extends a.html in index.html. thanks ...

C++ boost template parameter traits

hello. I believe I had seen macro in boost that recovers template template parameters, for example: template<class> struct parameters; #define parameters(T) template<class A> \ struct parameters<T<A> > { typedef A type1; }; is there one like this, or am I wrong? Thank you ...

Editing Aspx Website Template with C#

I have a template for a website, and I want to edit the aspx files with C#, thats means that I want each of the aspx files have a code behind file, which is .aspx.cs file for each .aspx exist file. I opened a new ASP.NET AJAX Website Template and copied the .aspx files, the webconfig and the css to the new website I created. when I ad...

How should I organize a list of items by their category in Django?

I have a "Category" model, and a "Project" model, which contains a ForeignKey to "Category." So each Project can only belong to one Category. I want to create a list that ends up looking like the following: Category 1 Project 1 Project 2 Category 2 Project 3 Project 4 etc. I think the following psuedocode will work: <ul class="cate...

Masterpage with a dynamic template

In MVC.NET, how should I dynamically populate the HTML structure from a database into a Masterpage where the first the template needs to wrap the masterpage contents? AKA -- master page header stuff goes here -- ... -- Beginning of client template goes here -- ... -- masterpage contents goes here -- ... -- End of...

simple php Template engine

i friends i am working on simple php template engine here is some code can someboady help me to add files including function like %include.sidebar.html% and loop functions so i can run loops or tell me some other simple php template engine <? class Template { private $template, $vars; public function SetTemplete($tempname) { ...

What is the proper procedure on compiling templates and/or compiling with templates?

I have some template classes I've written that are dependencies for several other classes I need to compile. I have a few options as to how I can do this in my Makefile: Each class that requires a template lists its template requirements. This has the drawback of needing to recreate the dependency tree every time I want to add a new c...

how do you call this template constructor?

Possible Duplicate: C++ invoke explicit template constructor Hi, template <typename T> class testing { public: template <typename R> testing() { // constructor A } template <typename R> testing(const R&) { // constructor B } }; What is the syntax to invoke the constructor A? ...

How to use local classes with templates?

GCC doesn't seem to approve of instanciating templates with local classes: template <typename T> void f(T); void g() { struct s {}; f(s()); // error: no matching function for call to 'f(g()::s)' } VC doesn't complain. How should it be done? ...

Django template timesince filter - limit

Is it possible to limit django timesince filter say to 7 days. If date is more than 7 days, don't apply the filter ...

Rails - How to differentiate an action call from different pages?

I have a destroy action defined for a particular resource. On completion, it uses an rjs file with a visual effect to remove the resource from the page that it is being called from. My problem is that the destroy action can be called from 2 different templates. And so the visual effect needs to be different, depending on which template ...

why have most of the files in a dreamweaver site been put into a directory called 'upload'?

I cleaned up someone's style sheet for a Dreamweaver site, by editing the css directly, and now the secretary is having trouble using her old template. Most of the files in her site reside in subdirectories of the 'upload' directory. For example, I would have expected to see the stylesheet in ../assets/css/ etc. but in fact I'm fin...

Restrict C++ Template Parameter to Subclass

Hi How can I force a template parameter T to be a subclass of a specific class Baseclass? Something like this: template <class T : Baseclass> void function(){ T *object = new T(); } Thanks in advance. ...

django calling no request view function in template

Hello, I am making some view functions to calculate the rank of one user in a community. My problem is that i want to display the rank afferent to each user, in its profile, and i don't know how, since i don;t have a request and a render_to_response (cause i guessed they are not needed) my code: def calculate_questions_vote(request): ...