templates

Magento Email Template Help

I need to format the date in an email template. The date gets included in the plain .html email as follows. Dispatch Date: {{var order.getShippingDate()}} Is there any way I can format this date? I've tried just using the standard php date() function to format it to no avail. ...

Is it possible to get the value type from an arbitrary iterator (C++)?

I have a class template <typename Iterator, typename Value> class Foo { public: Foo(const Iterator& it) { ... } ... private: map<Value, int> m_; } }; Is there any way to get rid of Value in the template? The Iterator may or may not be an STL iterator, but it's guaranteed that *it type is Value. I know about iterator_traits...

Test whether a class is polymorphic

Hello Group, We have a sub-project 'commonUtils' that has many generic code-snippets used across the parent project. One such interesting stuff i saw was :- /********************************************************************* If T is polymorphic, the compiler is required to evaluate the typeid stuff at runtime, and answer will be tr...

Magento XML layout with custom modules

Hi, I'm trying to include a custom template into the checkout process on the shipping page. I want that template to adopt the functionality of its parent template so I can use any of the shipping variables within the template. However I can't get magento to load the template. Here is my XML (the header scripts are adding successfully...

type traits specialization

template<typename T> class vec3 { public: typename T type_t; T x; T y; T z; }; template<typename T> struct numeric_type_traits_basic_c { typedef T type_t; typedef T scalar_t; }; template<typename T> struct numeric_type_traits_vec3_c { typedef T type_t; typedef typename T::type_t scalar_t; }; typedef numeric_type_traits_basic_c...

How do I make this template class compiling in both VC6 and VC9.

I have a template class compiling fine in VC6. But it is not compiling in VC9. For that I have added "typename" keyword in front of one type. After this it is compiling in vc9 but not in VC6. How do I make it compiling with both the compilers. #include <map> #include <vector> template <class T1, class T2> class A { public: std::pa...

Do typedefs of templates preserve static initialization order?

Within the same compilation unit, the C++ standard says that static initialization order is well defined -- it's the order of the declarations of the static objects. But using the Sun Studio 12 compiler I'm encountering unintuitive behavior. I've define a templated class helper<T> which contains a static member _data of type T and a stat...

Magento Template Variables

Hi, Is it possible to pass a variable from a parent template to a child template. For example, if i wanted to put some repeated HTML in a separate template that was included within a foreach loop in its parent template <?php foreach ($items as $item) { echo $this->getChildHtml('item_info'); } ?> I would want to be able to access ...

Undefined reference error for template method

This is driving me mad for the past 1.5 hrs, I know it's a small thing but cannot find what's wrong (the fact that it's a rainy Friday afternoon, of course, does not help). I have defined the following class that will hold configuration parameters read from a file and will let me access them from my program: class VAConfig { friend...

(Obj) C++: Instantiate (reference to) class from template, access its members?

Hi-- I'm trying to fix something in some Objective C++ (?!) code. I don't know either of those languages, or any of the relevant APIs or the codebase, so I'm getting stymied left and right. Say I have: Vector<char, sizeof 'a'>& sourceData(); sourceData->append('f'); When i try to compile that, I get: error: request for member '...

Why can't you use a Template when iterating

When compiling : #include <vector> template<class T> class foo { void bar() { std::vector<T> x; std::vector<T>::iterator i = x.begin(); } }; int main() { return 0; } I get : # g++ ~test.cpp test.cpp: In member function `void foo<T>::bar()': test.cpp:7: error: expected `;' before "i" Shouldn't this w...

Covariant virtual functions and smart pointers

In C++, a subclass can specify a different return type when overriding a virtual function, as long as the return type is a subclass of the original return type (And both are returned as pointers/references). Is it possible to expand this feature to smart pointers as well? (Assuming a smart pointer is some template class) To illustrate:...

Function template with an operator (C++)

In C++, can you have a templated operator on a class? Like so: class MyClass { public: template<class T> T operator()() { /* return some T */ }; } This actually seems to compile just fine, but the confusion comes in how one would use it: MyClass c; int i = c<int>(); // This doesn't work int i = (int)c(); // Neither does this*...

Initializing template base-class member types in derived-class initializer lists

Here is some code outlining a problem I've been wrestling with. The final problem (as far as g++ is concerned at the moment) is that: "error: 'Foo-T' was not declared in this scope" when performing the Bar::Bar(...) constructor routine. Otherwise, the problem I'm attempting to learn my way through is one of setting base-class member type...

What is the difference between function template and template function?

What is the difference between function template and template function? ...

Template for JSON data?

I found this? Is this the best way to do it? http://weblogs.asp.net/dwahlin/archive/2009/05/03/using-jquery-with-client-side-data-binding-templates.aspx I'm looking to use some sort of repeat loop with variables that throw in JSON data. I am using Codeignitor and jquery. Thanks ...

Derived template-class access to base-class member-data

This question is a furtherance of the one asked in this thread. Using the following class definitions: template <class T> class Foo { public: Foo (const foo_arg_t foo_arg) : _foo_arg(foo_arg) { /* do something for foo */ } T Foo_T; // either a TypeA or a TypeB - TBD foo_arg_t _foo_arg; }; template <...

c++ templatized interface

This is best described in pseudo-code: class Thing {}; interface ThingGetter<T extends Thing> { T getThing(); } class Product extends Thing {}; class ProductGetter<Product> { Product getThing() { // Some product code } } class SpecialProductGetter extends ProductGetter { Product getThing() { p = Produ...

Making WP Templates

I have a wordpress blog and I would like to make a custom design myself... I dont want to pay a bunch of money for a company to make it for me Why are the templates broken into a bunch of different files? What are some tutorials you know of on how to make wp themes/templates? Thanks -Techy ...

Which templating engine is this?

At my current place of work we have to use a web-service which works with a text template we feed to it. Now we would like to use those templates at other places in code and so I wondered what template language that could possibly be and if it's some off-the-shelf or off-the-net software. It's presumably something from Java or .NET world...