templates

Create your own tags/functions with Erubis

Hi all, I have a ruby class that extends Erubis (a ruby templating engine) and I would like to create my own tags. The following is an example of what i'd like to be reproduce: <%= link_to "/some/url" %> This code should generate a html 'a' tag linking to some url. Now i'd like to be able to create my own tags such as: <%= javascrip...

What are my options for HTML templating when not using a web server?

Rules One option per answer List language constraints A minimum of one pro and one con At least one URL resource. If your feeling generous include a description or your own experience with it. ...

C++ / templates / GCC 4.0 bug?

Hi guys, Provided the code below: template<class _ResClass, class _ResLoader=DefaultLoader> class Resource : public BaseResource { private: _ResClass data_; public: explicit Resource(const std::string& path) : data_( _ResLoader::load< _ResClass >( path )) { }; }; Why would it fail but this one will work?: template<c...

Is there a way to have a single static variable for a template class (for all types) without breaking encapsulation

I need a way to have a single static variable for all kinds of types of my template class template <class T> class Foo { static Bar foobar;}; Well, the line above will generate a Bar object named foobar for every type T, but this is not what i want, i basically want a way to declare a variable of type Bar, so every object of type F...

Different approach to single static variable for a template class

I never really had a necessity for a global variable in a template (and actually I don't support a design like this very much) but this topic got me curious. Even though answered, it inspired me trying a different approach. Instead of using inheritance, I came up with this: class Bar {}; class { private: Bar bar; template <cla...

Template / Namespace Interactions

I came across a compile.. oddity? recently that led me to believe that a template, when created, is created in the same namespaces (or, at least, using the same namespaces) as where is was declared. That is; template<class T> class bar { public: static int stuff(){return T::stuff();} }; namespace ONE { struct foo { ...

Getting WPF Templated items from Control and Data templates

Hi, How do I get a named control from a control that is bound to a control template or data template? I have tried FindName it does not work. I prefer not to use the VisualTreeHelper as you have to traverse through each parent chld item individually. Thanks ...

Get Template Name - Smarty

I'm dealing with website is a mess and need to find out the template file that smarty is rendering. Is there a method on the smarty template object that I can call to get the current template file? for example echo $tplObj->getTemplate(); // echos "shop/templates/cart.tpl" ...

Why can't I reset the Background of the TextBox in my UserControl?

I've built a UserControl that extends the functionality of the ComboBox in interesting and useful ways. It looks like this when it's dropped down: I've built a whole bunch of features into the control and they all work smoothly. This leads me to believe that I have something of a clue as to what I'm doing. You'd think it would be a...

How can I use templated typedefs, that are _in_ a class, from outside the class (e.g. by another class), in relation to boost::graph

Hi, I found a very useful answer on how to create templated graphs using boost::graph under http://stackoverflow.com/questions/671714/modifying-vertex-properties-in-a-boostgraph/950173#950173 For me, this is very convenient as long as I do all the work on the graph in the Graph-class itself. However, it might be necessary to access in...

C# Templates for Visual Studio 2005

I'm looking for some template examples, such as a C# windows dialog. Do many hackers take advantage of template files? There are times when I'm creating dialog forms that are very similar. I want to make all my forms look and behave consistently, without doing a lot of coping and pasting. Add New Item -> My Templates ...

edited HTML wrapper template in Flash Builder 4 but my changes do not appear

I edited the index.template.html file, adding a script block to the HEAD section, but my changes are not there when running the project in Debug mode or in Run mode. I'm using SDK 4.0 with the public release of beta 2 (not using nightlies yet) and modified the only template found in this folder: \Adobe\Adobe Flash Builder Beta 2\sdks\...

Ruby on rails templates for apps (rails 2.3 version)

Is there any site or repository to download and/or share templates for Rails applications? Example: # template.rb run "rm public/index.html" generate(:scaffold, "person name:string") route "map.root :controller => 'people'" rake("db:migrate") git :init git :add => "." git :commit => "-a -m 'Initial commit'" And do that: rails myapp...

Pylons: Routes information availability from templates

Hi all, I'm building a Pylons application using evoque as our templating engine, though I think my question is relevant to other template engines. I have a base template that I'm using for our pages, and that base template does all the includes for CSS and Javascript files. I'd like to perform conditional test to include/exclude CSS and...

Convert collection of T into collection of QVariant in Qt

In Qt, how can I convert a typed collection of objects such as a QList<T> into a QList<QVariant>? I suppose I could construct a new list and copy the elements over, converting each to a QVariant along the way, but is there a shortcut? ...

Are there tools to translate any website into the templates its framework is using???

Rails, for example, has a defined set of patterns it uses to define ids and other attributes in html, for example <input id="project[task_attributes][]" .../> is the result of something like <%= fields_for :task %> nested inside of <%= form_for :project %>. I'm sure other frameworks do the same. This means that if you went to a random ...

Why is the WPF property IsDefaulted not found?

I was working on my button template with this example: http://msdn.microsoft.com/en-us/library/ms753328.aspx I found the "IsDefaulted" property quite useful, but can't use it. I have the following trigger setup: <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter TargetName...

Debugging report error on SSRS

Hi Folks, we have a bunch of reports (RDL) on SSRS built using officewriter. Sometimes errors occur in a report after updating the excel template. While the report renders fine, an error occurs on the server when trying to save the report using 'export to excel format for office writer' option. How do we debug to find the cause of the er...

How to make Django template engine to render in memory templates?

I am storing my templates in the database and I don't have any path to provide for the template.render method. Is there any exposed method which accepts the template as a string? Is there any workaround? ...

Improving a simple JavaScript templating technique

I'm trying to develop a simple way of creating templates in JavaScript. The basic idea is that I've got HTML in a page that represents the UI of an object in JavaScript, and variables in that HTML that are replaced with properties of the JavaScript object. Think of it as technique for binding JavaScript objects to HTML presentations. A...