templates

XSL Template Node Navigation

Thank you one and all. I have an PHP MVC framework that uses XSLT for the templates. I have registered some php functions with the template to allow the use of modules in the template. This allows us to call modules at need be instead of running all the modules first regardless if you need them all. The problem is the fact some (most, ...

reinterpret casting to and from unsigned char* and char*

I'm wondering if it is necessary to reinterpret_cast in the function below. ITER_T might be a char*, unsigned char*, std::vector<unsigned char> iterator, or something else like that. It doesn't seem to hurt so far, but does the casting ever affect how the bytes are copied at all? template<class ITER_T> char *copy_binary( unsigned ch...

Most commonly used syntax for a templating engine?

I'm writing a template engine (something that will add data to a template to produce a document, like that used in Active Server Pages or JavaServerPages or PHP - or even shell/bash scripts, ant or Word form letters). Some examples: ${yourVariableHere} <TMPL_LOOP NAME=EMPLOYEE_INFO> <%= toStringOrBlank( "expanded inline data " + 1 ) %>...

Django ManyToMany Template Questions

Good Morning All, I've been a PHP programmer for quite some time, but I've felt the need to move more towards the Python direction and what's better than playing around with Django. While in the process, I'm come to a stopping point where I know there is an easy solution, but I'm just missing it - How do I display manytomany relationsh...

WPF: How do I bind the color property of a gradientstop that is located in a controlTemplate in vb code?

I need to do this in order to create a dynamic background brush for a custom control (inherits ContentControl). My custom control has two dependency properties: StartColor and EndColor. In the control template for the custom control, the control is wrapped in a border that's background is a RadialGradientBrush with gradient stops. one gr...

Getting the SubSonic MVC Templates to work with my database.

I downloaded and installed the SubSonic MVC templates. I'm able to create a new project from this template and the 'prewritten' views work fine. I'm able to edit records from the Artist table of the included 'Chinook' database. So now I'd like to get this to work with MY database. Here's what I've done. Changed to connectionstring in...

ASP.NET MVC 2 - HTML.EditorFor() and Custom EditorTemplates

With MVC 2's addition of the HtmlHelper EditorFor() it is not possible to create strongly typed Display and Editor templates for a given Model object and after fiddling with it I am a bit stumped as to how to pass additional Model data to the editor without losing the strong-typing of the editor control. Classic Example: Product has Cat...

Dynamically include template elements from other apps in Django

App_1 has a view and a template for this view. It would like to "aggregate" information into this view from other sources (i.e. other apps), without having to add or change anything itself. Perhaps App_2 wants to put "hello world" into this designated area in App_1's view. What is the best way of achieving this? Signals come to mind nat...

asp.net - templates

What does the word 'Template' mean when talking about ASP.NET? For example I have heard about Page template, item template, etc. What are they? ...

Why doesn't a derived template class have access to a base template class

Consider: template <typename T> class Base { public: static const bool ZEROFILL = true; static const bool NO_ZEROFILL = false; } template <typename T> class Derived : public Base<T> { public: Derived( bool initZero = NO_ZEROFILL ); // NO_ZEROFILL is not visible ~Derived(); } I can't compile...

Wicket: Conditional display in Template

Hy, I want to display a certain part (a div for example) of my wicket-template only under a certain condition (for example only if I have the data to fill it). The problem is: If I only add the panel (filling the div) if I got the data, an exception is thrown every time I call the page without the data (because the referenced wicket-id ...

Multiple blocks of same name in Jinja2

In Jinja2, I have a base template like this: <title>{% block title %}{% endblock %} - example.com</title> [...] <h1> {% block title %}{% endblock %} - example.com </h1> Jinja2, then, fails with the following message: lines = [self.message, ' ' + location] : block 'title' defined twice It must be now evident as to what I am t...

[Django] Can I use more than a single filter on a variable in template?

For example: {{test|linebreaksbr|safe}} ...

Django shared template

Hi, I'm looking how to do the best something like a UserControl in ASP.NET in Django. For example: 1) There's a Book model defined 2) There's a regular representation of the book which I want to use all over my site (called "book_template.html"). Now let's say I want to use this one representation from 2 views: recent_books_view, pop...

generic non-invasive cache wrapper

I'm trying create a class which adds functionality to a generic class, without directly interfacing with the wrapped class. A good example of this would be a smart pointer. Specifically, I'd like to create a wrapper which caches all the i/o for one (or any?) method invoked through the wrapper. Ideally, the cache wrapper have the follo...

How to avoid infinite recursion in C++ class templates

I have a matrix class with the size determined by template parameters. template <unsigned cRows, unsigned cCols> class Matrix { ... }; My program uses matrices of a few sizes, typically 2x2, 3x3, and 4x4. By setting the matrix size with template parameters rather than run-time parameters allows the compiler to do a lot of inlinin...

Adding Grid and Controls dynamically in WPF.

I am now doing an application that shows the HDD usage in the system. For that I want to generate the grid and the controls (like progress bar and labels) dynamically to show the usage. Is there any XAML template available for this purpose? ...

Building a call table to template functions in C++

I have a template function where the template parameter is an integer. In my program I need to call the function with a small integer that is determined at run time. By hand I can make a table, for example: void (*f_table[3])(void) = {f<0>,f<1>,f<2>}; and call my function with f_table[i](); Now, the question is if there is some aut...

interfaces for templated classes

I'm working on a plugin framework, which supports multiple variants of a base plugin class CPlugin : IPlugin. I am using a boost::shared_ptr<IPlugin> for all reference to the plugins, except when a subsystem needs the plugin type's specific interface. I also need the ability to clone a plugin into another seprate object. This must return...

Is it legal C++ to pass the address of a static const int with no definition to a template?

I'm having trouble deciding whether not this code should compile or if just both compilers I tried have a bug (GCC 4.2 and Sun Studio 12). In general, if you have a static class member you declare in a header file you are required to define it in some source file. However, an exception is made in the standard for static const integrals. ...