templates

How to set variables in base template in django?

i have template base.html and some children templates. I don't know how to set variables for base.html for example if i have {% for u in users %}{% endfor %} where do I assign it to users? is there some parent view for all views? ...

What is a good dumbed-down, safe template system for PHP?

(Summary: My users need to be able to edit the structure of their dynamically generated web pages without being able to do any damage.) Greetings, ladies and gentlemen. I am currently working on a service where customers from a specific demographic can create a specific type of web site and fill it with their own content. The system is ...

Mixing policy-based design with CRTP in C++

I'm attempting to write a policy-based host class (i.e., a class that inherits from its template class), with a twist, where the policy class is also templated by the host class, so that it can access its types. One example where this might be useful is where a policy (used like a mixin, really), augments the host class with a polymorphi...

Specializing a template on a lambda in C++0x

I've written a traits class that lets me extract information about the arguments and type of a function or function object in C++0x (tested with gcc 4.5.0). The general case handles function objects: template <typename F> struct function_traits { template <typename R, typename... A> struct _internal { }; template <typename ...

Is it good to have a member template function inside a non-template class in c++?

I wonder if it is a good practice to have a member template function inside a non-template class in c++? Why? I'm trying to do something like this in classA.h: classA { public: member_func1(); member_func2(); }; in classA.cpp: template <class T> share_func(); classA::member_func1() { call share_func(); } classA::mem...

C++ explicit template specialization of templated constructor of templated class

I have a class like template <class T> struct A{ template <class U> A(U u); }; I would like to write an explicit specialization of this for a declaration like A<int>::A(float); In the following test code, if I comment out the specialization, it compiles with g++. Otherwise, it says I have the wrong number of template parame...

In the following implementation of static_strlen, why are the & and parentheses around str necessary?

If I change the type to const char str[Len], I get the following error: error: no matching function for call to ‘static_strlen(const char [5])’ Am I correct that static_strlen expects an array of const char references? My understanding is that arrays are passed as pointers anyway, so what need is there for the elements to be reference...

PHP template class with variables?

I want to make developing on my new projects easier, and I wanted a bare bones very simple template engine solution. I looked around on the net and everything is either too bloated, or makes me cringe. My HTML files will be like so: <html> <head> <title>{PAGE_TITLE}</title> </head> <body> <h1>{PAGE_HEADER}</...

Higher-kinded Types with C++

This question is for the people who know both Haskell (or any other functional language that supports Higher-kinded Types) and C++... Is it possible to model higher kinded types using C++ templates? If yes, then how? EDIT : From this presentation by Tony Morris: Higher-order Polymorphism : Languages such as Java and C# have first-o...

How can I make a really fancy SELECT/option drop down menu?

This must work on the iPhone and mobile browsers. This has to be lightweight. I'm looking for a good CSS3 option. ...

How do I get the CSS of this element?

http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html Is you go to this website. Scroll down to "Using the Button Element". Then the first black button called "Super Awesome button" What is the full CSS for this? Just one class. I want all the attributes of this. Is there any way to see it , just one class? In firebug it has a ...

Noob Question: Wordpress Looping

Can someone give me an essential Wordpress Loop and explain to me what's happening with it? I'd like to put together some templates, but I don't do well with blackboxing. In other words, I'm fully capable of writing my own CMS, but when it comes to using someone else's and its arbitrary rules, I'm completely at a loss, and I just can't g...

Why can't I create a templated sublcass of System::Collections::Generic::IEnumerable<T>?

I want to create a generic IEnumerable implementation, to make it easier to wrap some native C++ classes. When I try to create the implementation using a template parameter as the parameter to IEnumerable, I get an error. Here's a simple version of what I came up with that demonstrates my problem: ref class A {}; template<class B> re...

Minimalistic PHP template engine with caching but not Smarty?

There are loads of questions for "the right" PHP template engine, but none of them is focused on caching. Does anybody know a lightweight, high-quality, PHP 5 based template engine that does the following out of the box: Low-level templating functions (Replacements, loops, and filtering, maybe conditionals) Caching of the parsed resul...

C++ Template Classes and Copy Construction

Is there any way I can construct an new object from the given object if the template parameters of both objects are identical at run-time? For example: I have a template class with the declaration: template<typename _Type1, typename _Type2> class Object; Next, I have two instantiations of the template: template class Object<char, in...

Django conditional template inheritance

I have template that displays object elements with hyperlinks to other parts of my site. I have another function that displays past versions of the same object. In this display, I don't want the hyperlinks. I'm under the assumption that I can't dynamically switch off the hyperlinks, so I've included both versions in the same template....

How to check whether a particular widget is show or not in the sidebar ?

i want to code something in my post template. So, is there any way to check whether a widget that i want to show will be shown in sidebar or not ? ...

Changing output of Forms with Struts+Freemarker

I'm working on a Website with Struts2 and Freemarker. Whenever I add form tags such as: <@s.form action="foo"> <@s.combobox (...)/> It generates a bunch of html/css/javascript that I don't need. Is there any way I can specify that no extra elements should be generated or do I really need to go into Freemarker.jar and edit...

design suggestion for a message decoder in delphi

Hi All, I want to implement a RPC module. Different requests are encoded as JSON objects. They will be decoded and then be handled by a request handler. At last a corresponding response will be returned. The demo code looks as follows: type IRequestHandler = interface function Handle(const Request: TAaaRequest): TResponse; f...

Customization for VersionDiff.aspx in sharepoint

Hi. I have a Wiki site, and on wiki pages if I select to check history of pages it displays in the Left action panel Version and date as hyperlinks. It uses SharePoint's Diff iterator, I want to do a bit of customization here, along with date I want to display field values too. How can I do that? Thanks, Azra ...