Search Results

Search found 6937 results on 278 pages for 'template'.

Page 6/278 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Is there a way to automatically make a makefile from a template toolkit template?

    - by Smack my batch up
    My static web pages are built from a huge bunch of templates which are inter-included using Template Toolkit's "import" and "include", so page.html looks like this: [% INCLUDE top %] [% IMPORT middle %] Then top might have even more files included. I have very many of these files, and they have to be run through to create the web pages in various languages (English, French, etc., not computer languages). This is a very complicated process and when one file is updated I would like to be able to automatically remake only the necessary files, using a makefile or something similar. Are there any tools which can parse template toolkit templates and create a dependency list for use in a makefile? Or are there better ways to automate this process?

    Read the article

  • How to test custom template tags in Django?

    - by Mark Lavin
    I'm adding a set of template tags to a Django application and I'm not sure how to test them. I've used them in my templates and they seem to be working but I was looking for something more formal. The main logic is done in the models/model managers and has been tested. The tags simply retrieve data and store it in a context variable such as {% views_for_object widget as views %} """ Retrieves the number of views and stores them in a context variable. """ # or {% most_viewed_for_model main.model_name as viewed_models %} """ Retrieves the ViewTrackers for the most viewed instances of the given model. """ So my question is do you typically test your template tags and if you do how do you do it?

    Read the article

  • Convert template from "rounded corners" to "square"

    - by marco92w
    I've downloaded the following template: http://www.styleshout.com/templates/preview/Refresh11/index.html But unfortunately, it has rounded corners and shades. I want it to have square corners and the shades should be removed, too. It should look like this: But I'm not good enough at (X)HTML and CSS so I didn't manage to achieve this. Could you please help me? How could I remove the rounded corners? Please don't say "Take another template" ;) It's also for learning purposes :)

    Read the article

  • How can I handle template dependencies in Template Toolkit?

    - by Smack my batch up
    My static web pages are built from a huge bunch of templates which are inter-included using Template Toolkit's "import" and "include", so page.html looks like this: [% INCLUDE top %] [% IMPORT middle %] Then top might have even more files included. I have very many of these files, and they have to be run through to create the web pages in various languages (English, French, etc., not computer languages). This is a very complicated process and when one file is updated I would like to be able to automatically remake only the necessary files, using a makefile or something similar. Are there any tools like makedepend for C files which can parse template toolkit templates and create a dependency list for use in a makefile? Or are there better ways to automate this process?

    Read the article

  • compiler warning at C++ template base class

    - by eike
    I get a compiler warning, that I don't understand in that context, when I compile the "Child.cpp" from the following code. (Don't wonder: I stripped off my class declarations to the bare minuum, so the content will not make much sense, but you will see the problem quicker). I get the warning with VS2003 and VS2008 on the highest warning level. The code AbstractClass.h : #include <iostream> template<typename T> class AbstractClass { public: virtual void Cancel(); // { std::cout << "Abstract Cancel" << std::endl; }; virtual void Process() = 0; }; //outside definition. if I comment out this and take the inline //definition like above (currently commented out), I don't get //a compiler warning template<typename T> void AbstractClass<T>::Cancel() { std::cout << "Abstract Cancel" << std::endl; } Child.h : #include "AbstractClass.h" class Child : public AbstractClass<int> { public: virtual void Process(); }; Child.cpp : #include "Child.h" #include <iostream> void Child::Process() { std::cout << "Process" << std::endl; } The warning The class "Child" is derived from "AbstractClass". In "AbstractClass" there's the public method "AbstractClass::Cancel()". If I define the method outside of the class body (like in the code you see), I get the compiler warning... AbstractClass.h(7) : warning C4505: 'AbstractClass::Cancel' : unreferenced local function has been removed with [T=int] ...when I compile "Child.cpp". I do not understand this, because this is a public function and the compiler can't know if I later reference this method or not. And, in the end, I reference this method, because I call it in main.cpp and despite this compiler warning, this method works if I compile and link all files and execute the program: //main.cpp #include <iostream> #include "Child.h" int main() { Child child; child.Cancel(); //works, despite the warning } If I do define the Cancel() function as inline (you see it as out commented code in AbstractClass.h), then I don't get the compiler warning. Of course my program works, but I want to understand this warning or is this just a compiler mistake? Furthermore, if do not implement AbsctractClass as a template class (just for a test purpose in this case) I also don't get the compiler warning...?

    Read the article

  • jQuery templates - Load another template within a template (composite)

    - by Saxman
    I'm following this post by Dave Ward (http://encosia.com/2010/12/02/jquery-templates-composite-rendering-and-remote-loading/) to load a composite templates for a Blog, where I have a total of 3 small templates (all in one file) for a blog post. In the template file, I have these 3 templates: blogTemplate, where I render the "postTemplate" Inside the "postTemplate", I would like to render another template that displays comments, I called this "commentsTemplate" the "commentsTemplate" Here's the structure of my json data: blog Title Content PostedDate Comments (a collection of comments) CommentContents CommentedBy CommentedDate For now, I was able to render the Post content using the code below: Javascript $(document).ready(function () { $.get('/GetPost', function (data) { $.get('/Content/Templates/_postWithComments.tmpl.htm', function (templates) { $('body').append(templates); $('#blogTemplate').tmpl(data).appendTo('#blogPost'); }); }); }); Templates <!--Blog Container Templates--> <script id="blogTemplate" type="x-jquery-tmpl"> <div class="latestPost"> {{tmpl() '#postTemplate'}} </div> </script> <!--Post Item Container--> <script id="postTemplate" type="x-jquery-tmpl"> <h2> ${Title}</h2> <div class="entryHead"> Posted in <a class="category" rel="#">Design</a> on ${PostedDateString} <a class="comments" rel="#">${NumberOfComments} Comments</a></div> ${Content} <div class="tags"> {{if Tags.length}} <strong>Tags:</strong> {{each(i, tag) Tags}} <a class="tag" href="/blog/tags/{{= tag.Name}}"> {{= tag.Name}}</a> {{/each}} <a class="share" rel="#"><strong>TELL A FRIEND</strong></a> <a class="share twitter" rel="#">Twitter</a> <a class="share facebook" rel="#">Facebook</a> {{/if}} </div> <!-- close .tags --> <!-- end Entry 01 --> {{if Comments.length}} {{each(i, comment) Comments}} {{tmpl() '#commentTemplate'}} {{/each}} {{/if}} <div class="lineHor"> </div> </script> <!--Comment Items Container--> <script id="commentTemplate" type="x-jquery-tmpl"> <h4> Comments</h4> &nbsp; <!-- COMMENT --> <div id="authorComment1"> <div id="gravatar1" class="grid_2"> <!--<img src="images/gravatar.png" alt="" />--> </div> <!-- close #gravatar --> <div id="commentText1"> <span class="replyHead">by<a class="author" rel="#">${= comment.CommentedBy}</a>on today</span> <p> {{= comment.CommentContents}}</p> </div> <!-- close #commentText --> <div id="quote1"> <a class="quote" rel="#"><strong>Quote this Comment</strong></a> </div> <!-- close #quote --> </div> <!-- close #authorComment --> <!-- END COMMENT --> </script> Where I'm having problem is at the {{each(i, comment) Comments}} {{tmpl() '#commentTemplate'}} {{/each}} Update - Example Json data when GetPost method is called { Id: 1, Title: "Test Blog", Content: "This is a test post asdf asdf asdf asdf asdf", PostedDateString: "2010-12-20", - Comments: [ - { Id: 1, PostId: 1, CommentContents: "Test comments # 1, asdf asdf asdf", PostedBy: "User 1", CommentedDate: "2010-12-20" }, - { Id: 2, PostId: 1, CommentContents: "Test comments # 2, ghjk gjjk gjkk", PostedBy: "User 2", CommentedDate: "2010-12-21" } ] } I've tried passing in {{tmpl(comment) ..., {{tmpl(Comments) ..., or leave {{tmpl() ... but none seems to work. I don't know how to iterate over the Comments collection and pass that object into the commentsTemplate. Any suggestions? Thank you very much.

    Read the article

  • Hide Joomla Template in Controller

    - by codeworxx
    Hey Guys, i have a big Joomla 1.5 Problem. I'll create my own Gallery Component/PlugIn and want to add an AJAX Sorting possibility. In the Backend i want to reorder the Images by Drag&Drop in an Gallery. It works, but for the Output i have the following Problem: I send the AJAX Request to index.php?option=com_cwgallery&controller=gallerie&task=ajax As i told you, it works, but i want to display the result in a Layer. But Joomla always sends the complete Template and the Result back. How can i disable sending the Admin Template??? Hope you understand what i mean? Thanks, Sascha

    Read the article

  • C++ HTML template framework, templatizing library, HTML generator library

    - by Marcin Gil
    I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc. It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc. Parameter passing to template rendering engine is also important if I could pass all of them in a hash map instead of calling some function for each of parameters. Do you have any recommendations? I can see also the possibility of embedding languages like Lua, however I haven't found a templatizing library for that either. Thanks!

    Read the article

  • how to get the type of a deferred template parameter

    - by smerlin
    Is there a way to get the defered type of a class template parameter ? template <class TPtr> struct foo { typedef TPtr ptr_type; typedef ??? element_type; /* shall be the type of a deferred TPtr*/ }; so foo<const char*>::element_type results in const char, and foo<std::vector<int>::iterator_type>::element_type results in int. i am aware of that i can use the value_type typedef for c++ iterators (like std::vector<int>::iterator_type::value_type), but raw pointers havent got a value_type typedef, so i am out of luck there.

    Read the article

  • Template type deduction with a non-copyable class

    - by Evan Teran
    Suppose I have an autolocker class which looks something like this: template <T> class autolocker { public: autolocker(T *l) : lock(l) { lock->lock(); } ~autolocker() { lock->unlock(); } private: autolocker(const autolocker&); autolocker& operator=(const autolocker&); private: T *lock; } Obviously the goal is to be able to use this autolocker with anything that has a lock/unlock method without resorting to virtual functions. Currently, it's simple enough to use like this: autolocker<some_lock_t> lock(&my_lock); // my_lock is of type "some_lock_t" but it is illegal to do: autolocker lock(&my_lock); // this would be ideal Is there anyway to get template type deduction to play nice with this (keep in my autolocker is non-copyable). Or is it just easiest to just specify the type?

    Read the article

  • Which jsPerf-test should I consider as standard for checking the performance of javascript template-engines

    - by bhargav
    I am on a search for a javascript template engine that has good performance when used in large js applications and is also very suitable for mobile applications. So I have gone through the various jsPerf-tests for these. There seems to be a lot which show different results and it is confusing to find out which is the standard test. Can some one guide me a standard jsPerf that I can refer to and that should also include following templates dust, underscore, hogan, mustache, handlebars. From what I have observed dot.js is a constant performer with good rendering speed, but is it mature enough for larger applications ? What is this "with" and "no with" that is shown in the jspref tests? Can some one explain. In all the tests I have seen popular templates like mustache, handlebars, dust, hogan,etc seems to be behind performance than other templates, so why people are using them leaving out the top performers,is it because of maturity of these template engines? Thanks in advance

    Read the article

  • Codeigniter Template library, add_js() method

    - by Karl
    using This Template Library when i try and use the add_js() function it errors out. I add the regions $_scripts to the template header file but when i load the page it says undefined variable _scripts. any thoughts? changed <?= $_scripts ?> to <?= (isset($_scripts)) ? $_scripts : “”; ?> and obviously i lose the error but the js file still isnt loading. I did an echo at each step though the add_js() method and the output is correct. I also did an output of $this-js and they both had the corret output. So it gets through the get_js method fine and sets the class variable fine but i dont get anything added to the actual page.

    Read the article

  • C++ template parameter/class ambiguity

    - by aaa
    hello. while testing with different version of g++, the following problem came up template<class bra> struct Transform<bra, void> : kernel::Eri::Transform::bra { static const size_t ni = bra::A::size; bra::A is interpreted as kernel::Eri::Transform::bra::A, rather than template argument by g++ 4.1.2. on the other hand, g++ 4.3 gets it right. what should be correct behavior according to standard? Meanwhile, I refactor slightly to make problem go away.

    Read the article

  • Puzzle - Dynamically change data template control from another data template

    - by Burt
    I have a DataTemplate that contains an Expander with a border in the header. I want the header border to have round corners when collapsed and straight bottom corners when expanded. What would best practice be for achieving this (bonus points for code samples as I am new to XAML)? This is the template that holds the expander: <DataTemplate x:Key="A"> <StackPanel> <Expander Name="ProjectExpander" Header="{Binding .}" HeaderTemplate="{StaticResource B}" > <StackPanel> <Border CornerRadius="0,0,2,2"> This is the expander datatemplate: <DataTemplate x:Key="B"> <Border x:Name="ProjectExpanderHeader" CornerRadius="{Binding local:ItemUserControl.ProjectHeaderBorderRadius, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentPresenter}}}" Background="{StaticResource ItemGradient}" HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentPresenter}}, Mode=OneWayToSource}"> <local:ItemContentsUserControl Height="30"/> </Border> </DataTemplate>

    Read the article

  • C++ template typedef

    - by Notinlist
    I have a class template<size_t N, size_t M> class Matrix { // .... }; I want to make a typedef which creates a Vector (column vector) which is equivalent to a Matrix with sizes N and 1. Something like that: typedef Matrix<N,1> Vector<N>; Which produces compile error. The following creates something similar, but not exactly what I want: template <int N> class Vector: public Matrix<N,1> { }; Is there a solution or a not too expensive workaround / best-practice for it? Thanks in advance!

    Read the article

  • C++: Template functor cannot deduce reference type

    - by maciekp
    I've got a functor f, which takes a function func and a parameter t of the same type as func. I cannot pass g to f because of compilation error (no matching function for call to f(int&, void (&)(int&)) ). If g would take non-reference parameter g(int s), compilation finishes. Or if I manually specify template parameter f(i, g), compilation also finishes. template<typename T> void f(T t, void (*func)(T)) {} void g(int& s) {} int main(int, char*[]) { int i = 7; f(i, g); // compilation error here return 0; } How can I get deduction to work?

    Read the article

  • Template approach for a PHP application

    - by Industrial
    Hi everyone, We're in the middle of making a new e-commerce related PHP application and we have come to the point where we have started to think about how we should solve templating for our customers needs. What we would like to do is offer our customers the possibility of uploading/modifying templates to suit their company:s profile. The initial thought is that we shall not reinvent the wheel, so instead letting our customers upload their templates with FTP, so there will be basic HTML skills required. For those customers that want to modify/customize template and doesnt have the knowledge, we offer that service as well. I know that there's a number of issues to solve before this could be considered safe, like preventing XSS and writing scripts that check through each uploaded file for potential security threats and so on. Of course, there are some part that probably will be to complex for the customer to modify by themselves, so maybe this approach won't apply to all<< template files in the frontend application. But besides that, what would be a good way to handle this?

    Read the article

  • Undefined template methods trick ?

    - by Matthieu M.
    A colleague of mine told me about a little piece of design he has used with his team that sent my mind boiling. It's a kind of traits class that they can specialize in an extremely decoupled way. I've had a hard time understanding how it could possibly work, and I am still unsure of the idea I have, so I thought I would ask for help here. We are talking g++ here, specifically the versions 3.4.2 and 4.3.2 (it seems to work with both). The idea is quite simple: 1- Define the interface // interface.h template <class T> struct Interface { void foo(); // the method is not implemented, it could not work if it was }; // // I do not think it is necessary // but they prefer free-standing methods with templates // because of the automatic argument deduction // template <class T> void foo(Interface<T>& interface) { interface.foo(); } 2- Define a class, and in the source file specialize the interface for this class (defining its methods) // special.h class Special {}; // special.cpp #include "interface.h" #include "special.h" // // Note that this specialization is not visible outside of this translation unit // template <> struct Interface<Special> { void foo() { std::cout << "Special" << std::endl; } }; 3- To use, it's simple too: // main.cpp #include "interface.h" class Special; // yes, it only costs a forward declaration // which helps much in term of dependencies int main(int argc, char* argv[]) { Interface<Special> special; foo(special); return 0; }; It's an undefined symbol if no translation unit defined a specialization of Interface for Special. Now, I would have thought this would require the export keyword, which to my knowledge has never been implemented in g++ (and only implemented once in a C++ compiler, with its authors advising anyone not to, given the time and effort it took them). I suspect it's got something to do with the linker resolving the templates methods... Do you have ever met anything like this before ? Does it conform to the standard or do you think it's a fortunate coincidence it works ? I must admit I am quite puzzled by the construct...

    Read the article

  • struct with template variables in c++

    - by monkeyking
    I'm playing around with template, so I'm not trying to reinvent the std::vector, I'm trying to get a grasp of templateting in c++. Can I do the following template <typename T> typedef struct{ size_t x; T *ary; }array; What I'm trying to do is a basic templated version of typedef struct{ size_t x; int *ary; }iArray; It looks like its working if I use a class instead of struct, so is it not possible with typedef structs? thanks

    Read the article

  • C++ abstract class template + type-specific subclass = trouble with linker

    - by user333279
    Hi there, The project in question is about different endpoints communicating with each other. An endpoint sends events (beyond the scope of the current problem) and can process incoming events. Each event is represented in a generic object as follows: #pragma interface ... // some includes template<typename T> class Event { public: Event(int senderId, Type type, T payload); // Type is an enum Event(int senderId, Type type, int priority, T payload); virtual ~Event(); virtual int getSenderId(); virtual int getPriority(); virtual T getPayload(); void setPriority(const int priority); protected: const int senderId; const Type type; const T payload; int priority; }; It has its implementing class with #pragma implementation tag. An endpoint is defined as follows: #pragma interface #include "Event.h" template<typename T> class AbstractEndPoint { public: AbstractEndPoint(int id); virtual ~AbstractEndPoint(); virtual int getId(); virtual void processEvent(Event<T> event) = 0; protected: const int id; }; It has its implementing class too, but only the constructor, destructor and getId() are defined. The idea is to create concrete endpoints for each different payload type. Therefore I have different payload objects and specific event classes for each type, e.g. Event<TelegramFormatA>, Event<TelegramFormatB> and ConcreteEndPoint for TelegramFormatA, ConcreteEndPoint for TelegramFormatB respectively. The latter classes are defined as class ConcreteEndPoint : AbstractEndPoint<TelegramFormatA> { ... } I'm using g++ 4.4.3 and ld 2.19. Everything compiles nicely, but the linker complaints about undefined references to type-specific event classes, like Event<TelegramFormatA>::Event(....) . I tried explicit instantiation using template class AbstractEndPoint<TelegramFormatA>; but couldn't get past the aforementioned linker errors. Any ideas would be appreciated.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >