templates

Given text in a #define, can it somehow be passed to a template?

Say I have a macro, FOO(name), and some template class Bar<> that takes one parameter (what type of parameter is the question). Everytime I call FOO with a different name, I want to get a different instantiation of Bar. The Bar<> template doesn't actually need to be able to get at the name internally, I just need to be sure that differen...

SubSonic Generates Namespace, but my website doesn't recognize it.

Hey there, I've got a pretty basic setup in Visual Studio 2008 - Website project referencing my Class library project. SubSonic 3 is referenced from both projects, but the Template has been modified for my MySQL db. It connects and generates the most of code (Accept for StoreProcs for some reason), and the namespace is there, and my ...

Joomla Template Overrides

Hi In joomla, I need to assign specially designed templates for both "User Edit" (Where user edits their details) /index.php?option=com_user&view=user&task=edit and "Search Results" I can't for the life of me work out how Joomla is selecting templates now. Certainly ItemID's aren't obvious and template overrides aren't giving any clu...

Why is the template argument deduction not working here?

Hello, I created two simple functions which get template parameters and an empty struct defining a type: //S<T>::type results in T& template <class T> struct S { typedef typename T& type; }; //Example 1: get one parameter by reference and return it by value template <class A> A temp(typename S<A>::type a1) { return a1; } //Exa...

T4, XML data source and relative path in Visual Studio 2008

Hi, I recently implemented a quick T4 template to generate some data access related classes in our app (Thanks Oleg). One problem I am facing is that my template does need to read data from an XML file that is part of the solution. Obviously, the path to the XML data must be relative. But when I first implemented it yesterday, it looke...

Template's member typedef use in parameter undeclared identifier in VS but not GCC

I'm looking at some codes which makes heavy uses of templates. It compiles fine on GCC, but not on VS (tested on 2003 - 2010 beta 1), where it fails during syntax analysis. Unfortunately I don't know enough of the code structure to be able reduce the problem and reproduce it in only a few lines, so I can only guess at the cause. I'm hopi...

Django-Template : Get Variables in a Tag block !

Hello, I need to retrieve an optional number saved in DB , to a custom template tag i made . which to retrieve , a variable ( a photo ID ) included in this Gallery . within the gallery loop . {% get_latest_photo {{photo.id}} %} How to accomplish that ?! P.s : I know that can be done with inclusion tag , but in the present time h...

Template not found in action method after calling a library method in symfony

Hi, I'm calling a method of a library that I've created in symfony 1.2. If I don't call the library method in the action method, then the method in the action class works as it should, and it finds the template. But, if I call the library method in the action class, symfony tells me that it cannot find the template associated to the acti...

Drupal: Views, blocks and template?

I have a block view called: "MYVIEW" And I have a region on my template called: "right". What must I call the template file to edit this? The following does not work: block-MYVIEW.tpl.php block-right--MYVIEW.tpl.php ...

How to check the TEMPLATE_DEBUG flag in a django template?

Do you know if it is possible to know in a django template if the TEMPLATE_DEBUG flag is set? I would like to disable my google analytics script when I am running my django app on my development machine. Something like a {% if debug %} template tag would be perfect. Unfortunately, I didn't find something like that in the documentation. ...

ComponentArt: Exporting the Grid Data

Hi all, I have a need to export the contents in a ComponentArt Grid into a file, preferably excel in csv format. I was wondering if anyone had any ideas how to best approach this task. At the moment we have the grid being populated with data, and using client templating some minor manipulation is being performed before it is displayed...

Skipping a C++ template parameter

Hi, A C++ hash_map has the following template parameters: template<typename Key, typename T, typename HashCompare, typename Allocator> How can I specify a Allocator without specifying the HashCompare? This won't compile :( hash_map<EntityId, Entity*, , tbb::scalable_allocator> ...

Drupal - logic of the template.php file

Hi guys, I have spent a good proportion of time today looking into expanding a drupal site I inherited, convinced that the issues I face were down to my bespoke SQL query. I have since realised that the SQL is ok (checked it in PHPMYadmin and got it executing of sorts within the drupal website). So I am happy I am getting all the resul...

In Django, is there an easy way to render a text field as a template, in a template ?

Can you think of an easy way to evaluate a text field as a template during the template rendering. I know how to do it in a view but I'm looking for a template Filter or a Tag ? Something like: {{ object.textfield|evaluate}} or {% evaluate object.textfield %} with object.textfield containing something like: a text with a {% Template...

How to delete buttons from a XML driven flash template from template monster

I am trying to delete some buttons from a XML drive flash template from template monster. After I delete the button from the XML file I can still see the button in flash and it has the title "Undefined". ...

Techniques to create PDF report from templates using iTextSharp

Hi, I've got a project where I need to generate PDF reports from a template. The report will have a header, details and a footer, and can potentially run on multiple pages. I was going to use iTextSharp for that. For the templates i was thinking of two options: PDF Form template HTML template Can you comment on the pros and cons of...

ForeignKey and Django Template

Hey, So here's the problem. Imagine 2 models: Photographer and Photo. Strict rule is that there can be only 1 photographer for image, so in Photo there's a ForeignKey link to Photographer. class Photographer(models.Model): name = models.CharField(max_length = 40) class Photo(models.Model): name = models.CharField(max_length =...

Pass pointer-to-template-function as function argument?

Say I want a C++ function to perform arithmetic on two inputs, treating them as a given type: pseudo: function(var X,var Y,function OP) { if(something) return OP<int>(X,Y); else if(something else) return OP<double>(X,Y); else return OP<string>(X,Y); } functions that fit OP might be like: template <class T> add(var X,var Y) ...

A template with variable number of types

Hi, I want to write a C++ template like this: template <class Type1, class Type2, class Type3,....> class MyClass { //... }; But, "the number of types" is variable. For example, a user can create an object with 3 types: MyClass<int, int, int> obj; or he can create an object with 5 types: MyClass<int, int, int, in...

Callback in C++, template member?

Following code does NOT work, but it expresses well what I wish to do. There is a problem with the template struct container, which I think SHOULD work because it's size is known for any template argument. class callback { public: // constructs a callback to a method in the context of a given object template<class C> callback(...