templates

Do you know of any popular PHP template engines for php that have concept of current context node?

This question is related to this one http://stackoverflow.com/questions/3940927/is-there-anything-like-dwoo-s-with-or-loop-in-smarty-3-or-earlier Basically I want to have something like current node from XSLT templates. In XSLT when I write something like: <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></t...

How to template'ize variable NAMES, not types ?

Hello, my question is about how to template'ize the name of a class member that should be used. Maybe a simplified & pseudo example: /** Does something with a specified member of every element in a List. */ template<membername MEMBER> // <-- How to define such thing? void doSomething(std::vector<MyClass> all){ for( i=0; i < all....

Templating solution for prototype CMS

Hi, Bit of a vague question. Apologies. I have a prototype CMS I've been working on for fun. It's completely written in ASP.NET MVC. It works on the principle of "widgets". Little blocks of functionality that can be dragged and dropped on the page, you get the idea. I have added a few simple blogging widgets which work well, one of...

Generic visitor pattern in java

Is the following java implementation of the visitor pattern using generics, general enough to be useful? (I suppose it is). Could it be improved in some way? It's important to be easily call-able using anonymous classes. Thanks. (Example of use): Vector<Number> numbers = new Vector<Number>(); numbers.add(new Double(1.2)); ...

C++ Constant preprocessor macros and templates

So say I have the following very simple macro, along with a bit of code to output it: #define SIMPLEHASH(STRING) STRING[1] + STRING[2] + STRING[3] std::cout << SIMPLEHASH("Blah"); This outputs 309, and if you view the assembly you can see: 00131094 mov ecx,dword ptr [__imp_std::cout (132050h)] 0013109A push 135h ...

Unable to resolve overloaded class methods in template delegate.

Background: I'm using a delegation technique to abstract access to arbitrary object methods, but I'm having some issues where the linker is concerned. Consider the following class, ContextNode. template <class ObjectType, class GetType, class SetType> class ContextNode: public ContextNodeBase { public: ContextNode(ObjectType* tar...

Style a button to match the current theme for the expand/collapse button on a TreeView

As you know, the built-in themes all define styles for the standard controls such as the TreeView control. We're trying to create something that looks an awful lot like a TreeView but isn't actually one, nor is it a subclass of one. It just has parts that we want to look like one for consistency. For instance, our control too has a se...

Errors in simple template code

template <class T> struct ABC { typedef typename T* pT; }; int main(){} The above piece of code gives errors expected nested-name-specifier before 'T' expected ';' before '*' token What is wrong with the code sample? ...

Is there an ASP.NET MVC 2 editor Templates library?

Hi, The custom (editor) templates in ASP.NET MVC 2 make it possible to create re-usable UI components (such as a selectlist, radio button list). Even ajax components are possible. Is there some website where developers can share their custom templates with each other? It seems a bit redudant to write these basic components by my own i...

Why do local variables in Magento have an underscore prefix?

As a follow up to an earlier question I wonder if anyone knows why Magento templates all declare their variables with an underscore. Templates are .phtml files include-ed from Mage_Core_Block_Template::fetchView(), their local variables are disposed of by the end of the function and never become global. So what's the point of an unders...

Issue while designing B+Tree template class in C++

Hi, I'm trying to write a generic C++ implementation of B+Tree. My problem comes from the fact that there are two kinds of nodes in a B+Tree; the internal nodes, which contain keys and pointers to child nodes, and leaf nodes, which contain keys and values, and pointers in an internal node can either point to other internal nodes, or le...

size_t and unsigned int does not match in a template function's parameter list

I want to use a stack to store indices of an array,so I use the following typedef,where istack is a template class for stack: typedef istack<size_t> IndexStack; and I declare a stack by IndexStack stack; But when I call the following function (where A.size() returns a size_t); stack.push_back(A.size()); GCC gives the follo...

Java generics versus C++ templates

I think I can sum up the use of generics in Java in one word: type-safety. Can you conclude the use of templates in C++ in one word, please? ...

Joomla : How to load template options depending on a specific menu Item

Hi I am developing a site based on Joomla 1.5 and I wanted to know how can we load varying template options dependiing on a menu item ID. A good example of what i am looking for is with the Gantry Framework (http://www.gantry-framework.org). Here you can change template settings on a per menu Item ID basis. A simple PHP or a jQuery s...

How to implement a generic DOM data structure in C++?

I'm trying to write a very simple implementation of Document Object Model library in order to provide a generic data structure to use in my further projects. Just to keep things simple I defined only three main classes: node, element and attribute. A node is defined by it's name (e.g. all html tags) and basically is a container for an el...

Drupal preprocess function and session

Hi, I set a session var at template preprocess function in a theme I use, but the first time I open the site I cant read the session var, if I refresh the page it works fine, anybody know what can be the problem?? This is the code I use in the preprocess function: function m_preprocess(&$vars, $hook) { $default_location = array( ...

Error trying to make an wrapper of the STL map container

I'm trying to make a wrapper to the STL map container, in order to add a const method to return the value given the key. In map, operator[] isn't const, and find() requires dereferencing to get the value (map.find()->second). I'm basing some of my "research" off of http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-...

<: cannot begin a template argument list

I get an error <: cannot begin a template argument list on g++ compiler. Code template<typename T> class SomeClass; class Class; SomeClass<::Class>* cls; ...

.htaccess redirect for .html

I have a site constructed using the TinyButStrong template system, so consisting of pairs of .php pages with .html templates. What rules should I use in a .htaccess file such that any call to a .html page is redirected to the .php? ...

What CodeIgniter template library is best?

Hello, As I see, there's a few Codeigniter template engines scattered all over the web, but unfortunately I can't recognize which is better in regard to: performance, features, maintenance ..etc Some of those I've reached and seems to be mature: Ocular-Template-Library http://github.com/lonnieezell/Ocular-Template-Library Template Lib...